Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f5c454e3

Von Niclas Zimmermann vor mehr als 10 Jahren hinzugefügt

  • ID f5c454e3855012bdb1928f3e4c4964403d4d8163
  • Vorgänger b989d7cf
  • Nachfolger f99b7288

Steuerzonen und Buchungsgruppen bearbeiten

Nachdem man Steuerzonen und Buchungsgruppen auf Datenbankebene
bearbeiten kann, ist jetzt auch eine Bearbeitung an der Ober-
fläche möglich.

Alter Code, der für die Anzeige/Bearbeitung/Erstellung von
Buchungsgruppen entwickelt wurde hat nicht mehr funktioniert
und wurde vollständig ersetzt.

Unterschiede anzeigen:

SL/AM.pm
739 739
  $main::lxdebug->leave_sub();
740 740
}
741 741

  
742

  
743
sub buchungsgruppe {
744
  $main::lxdebug->enter_sub();
745

  
746
  my ($self, $myconfig, $form) = @_;
747

  
748
  # connect to database
749
  my $dbh = $form->dbconnect($myconfig);
750
  # TODO: extract information about income/expense accounts from new table taxzone_chart
751
  my $query = qq|SELECT id, description,
752
                 inventory_accno_id,
753
                 (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno
754
                 FROM buchungsgruppen
755
                 ORDER BY sortkey|;
756

  
757
  my $sth = $dbh->prepare($query);
758
  $sth->execute || $form->dberror($query);
759

  
760
  $form->{ALL} = [];
761
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
762
    push @{ $form->{ALL} }, $ref;
763
  }
764

  
765
  $sth->finish;
766
  $dbh->disconnect;
767

  
768
  $main::lxdebug->leave_sub();
769
}
770

  
771
sub get_buchungsgruppe {
772
  $main::lxdebug->enter_sub();
773

  
774
  my ($self, $myconfig, $form) = @_;
775
  my $query;
776

  
777
  # connect to database
778
  my $dbh = $form->dbconnect($myconfig);
779

  
780
  if ($form->{id}) {
781
    # TODO: extract information about income/expense accounts from new table taxzone_chart
782
    $query =
783
      qq|SELECT description, inventory_accno_id,
784
         (SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno
785
         FROM buchungsgruppen
786
         WHERE id = ?|;
787
    my $sth = $dbh->prepare($query);
788
    $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
789

  
790
    my $ref = $sth->fetchrow_hashref("NAME_lc");
791

  
792
    map { $form->{$_} = $ref->{$_} } keys %$ref;
793

  
794
    $sth->finish;
795

  
796
    $query =
797
      qq|SELECT count(id) = 0 AS orphaned
798
         FROM parts
799
         WHERE buchungsgruppen_id = ?|;
800
    ($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id});
801
  }
802

  
803
  $query = "SELECT inventory_accno_id, income_accno_id, expense_accno_id ".
804
    "FROM defaults";
805
  ($form->{"std_inventory_accno_id"}, $form->{"std_income_accno_id"},
806
   $form->{"std_expense_accno_id"}) = selectrow_query($form, $dbh, $query);
807

  
808
  my $module = "IC";
809
  $query = qq|SELECT c.accno, c.description, c.link, c.id,
810
              d.inventory_accno_id, d.income_accno_id, d.expense_accno_id
811
              FROM chart c, defaults d
812
              WHERE c.link LIKE '%$module%'
813
              ORDER BY c.accno|;
814

  
815

  
816
  my $sth = $dbh->prepare($query);
817
  $sth->execute || $form->dberror($query);
818
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
819
    foreach my $key (split(/:/, $ref->{link})) {
820
      if (!$form->{"std_inventory_accno_id"} && ($key eq "IC")) {
821
        $form->{"std_inventory_accno_id"} = $ref->{"id"};
822
      }
823
      if ($key =~ /$module/) {
824
        if (   ($ref->{id} eq $ref->{inventory_accno_id})
825
            || ($ref->{id} eq $ref->{income_accno_id})
826
            || ($ref->{id} eq $ref->{expense_accno_id})) {
827
          push @{ $form->{"${module}_links"}{$key} },
828
            { accno       => $ref->{accno},
829
              description => $ref->{description},
830
              selected    => "selected",
831
              id          => $ref->{id} };
832
        } else {
833
          push @{ $form->{"${module}_links"}{$key} },
834
            { accno       => $ref->{accno},
835
              description => $ref->{description},
836
              selected    => "",
837
              id          => $ref->{id} };
838
        }
839
      }
840
    }
841
  }
842
  $sth->finish;
843

  
844

  
845
  $dbh->disconnect;
846

  
847
  $main::lxdebug->leave_sub();
848
}
849

  
850
sub save_buchungsgruppe {
851
  $main::lxdebug->enter_sub();
852

  
853
  my ($self, $myconfig, $form) = @_;
854

  
855
  # connect to database
856
  my $dbh = $form->dbconnect($myconfig);
857

  
858
  my @values = ($form->{description}, $form->{inventory_accno_id},
859
                $form->{income_accno_id_0}, $form->{expense_accno_id_0},
860
                $form->{income_accno_id_1}, $form->{expense_accno_id_1},
861
                $form->{income_accno_id_2}, $form->{expense_accno_id_2},
862
                $form->{income_accno_id_3}, $form->{expense_accno_id_3});
863

  
864
  my $query;
865

  
866
  # id is the old record
867
  if ($form->{id}) {
868
    $query = qq|UPDATE buchungsgruppen SET
869
                description = ?, inventory_accno_id = ?,
870
                income_accno_id_0 = ?, expense_accno_id_0 = ?,
871
                income_accno_id_1 = ?, expense_accno_id_1 = ?,
872
                income_accno_id_2 = ?, expense_accno_id_2 = ?,
873
                income_accno_id_3 = ?, expense_accno_id_3 = ?
874
                WHERE id = ?|;
875
    push(@values, $form->{id});
876
  } else {
877
    $query = qq|SELECT COALESCE(MAX(sortkey) + 1, 1) FROM buchungsgruppen|;
878
    my ($sortkey) = $dbh->selectrow_array($query);
879
    $form->dberror($query) if ($dbh->err);
880
    push(@values, $sortkey);
881
    $query = qq|INSERT INTO buchungsgruppen
882
                (description, inventory_accno_id,
883
                income_accno_id_0, expense_accno_id_0,
884
                income_accno_id_1, expense_accno_id_1,
885
                income_accno_id_2, expense_accno_id_2,
886
                income_accno_id_3, expense_accno_id_3,
887
                sortkey)
888
                VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
889
  }
890
  do_query($form, $dbh, $query, @values);
891

  
892
  $dbh->disconnect;
893

  
894
  $main::lxdebug->leave_sub();
895
}
896

  
897
sub delete_buchungsgruppe {
898
  $main::lxdebug->enter_sub();
899

  
900
  my ($self, $myconfig, $form) = @_;
901

  
902
  # connect to database
903
  my $dbh = $form->dbconnect($myconfig);
904

  
905
  my $query = qq|DELETE FROM buchungsgruppen WHERE id = ?|;
906
  do_query($form, $dbh, $query, $form->{id});
907

  
908
  $dbh->disconnect;
909

  
910
  $main::lxdebug->leave_sub();
911
}
912

  
913
sub swap_sortkeys {
914
  $main::lxdebug->enter_sub();
915

  
916
  my ($self, $myconfig, $form, $table) = @_;
917

  
918
  # connect to database
919
  my $dbh = $form->get_standard_dbh($myconfig);
920

  
921
  my $query =
922
    qq|SELECT
923
       (SELECT sortkey FROM $table WHERE id = ?) AS sortkey1,
924
       (SELECT sortkey FROM $table WHERE id = ?) AS sortkey2|;
925
  my @values   = ($form->{"id1"}, $form->{"id2"});
926
  my @sortkeys = selectrow_query($form, $dbh, $query, @values);
927

  
928
  $query  = qq|UPDATE $table SET sortkey = ? WHERE id = ?|;
929
  my $sth = prepare_query($form, $dbh, $query);
930

  
931
  do_statement($form, $sth, $query, $sortkeys[1], $form->{"id1"});
932
  do_statement($form, $sth, $query, $sortkeys[0], $form->{"id2"});
933

  
934
  $sth->finish();
935

  
936
  $dbh->commit();
937

  
938
  $main::lxdebug->leave_sub();
939
}
940

  
941 742
sub prepare_template_filename {
942 743
  $main::lxdebug->enter_sub();
943 744

  
SL/Controller/Buchungsgruppen.pm
1
package SL::Controller::Buchungsgruppen;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use SL::DB::TaxZone;
8
use SL::Helper::Flash;
9
use SL::Locale::String;
10
use SL::DB::TaxzoneChart;
11
use SL::Controller::ClientConfig;
12

  
13
use Rose::Object::MakeMethods::Generic (
14
  scalar                  => [ qw(config) ],
15
);
16

  
17
__PACKAGE__->run_before('check_auth');
18
__PACKAGE__->run_before('load_config', only => [ qw(edit update) ]); #destroy
19

  
20
#
21
# actions
22
#
23

  
24
sub action_list {
25
  my ($self) = @_;
26

  
27
  my $buchungsgruppen = SL::DB::Manager::Buchungsgruppe->get_all_sorted();
28
  my $taxzones        = SL::DB::Manager::TaxZone->get_all_sorted();
29

  
30
  my %chartlist = ();
31
  foreach my $gruppe (@{ $buchungsgruppen }) {
32
      $chartlist{ $gruppe->id } = SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($gruppe->id);
33
  }
34

  
35
  $::form->header;
36
  $self->render('buchungsgruppen/list',
37
                title           => t8('Buchungsgruppen'),
38
                BUCHUNGSGRUPPEN => $buchungsgruppen,
39
                CHARTLIST       => \%chartlist,
40
                TAXZONES        => $taxzones);
41
}
42

  
43
sub action_new {
44
  my ($self) = @_;
45

  
46
  $self->config(SL::DB::Buchungsgruppe->new());
47
  $self->show_form(title => t8('Add Buchungsgruppe'));
48
}
49

  
50
sub show_form {
51
  my ($self, %params) = @_;
52

  
53
  $self->render('buchungsgruppen/form', %params,
54
                 TAXZONES       => SL::DB::Manager::TaxZone->get_all_sorted(),
55
                 ACCOUNTS       => SL::Controller::ClientConfig->init_accounts(),
56
                 account_label  => sub { "$_[0]{accno}--$_[0]{description}" });
57
}
58

  
59
sub action_edit {
60
  my ($self) = @_;
61

  
62
  $self->show_form(title     => t8('Edit Buchungsgruppe'),
63
                   CHARTLIST => SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($self->config->id));
64
}
65

  
66
sub action_create {
67
  my ($self) = @_;
68

  
69
  $self->config(SL::DB::Buchungsgruppe->new());
70
  $self->create_or_update;
71
}
72

  
73
sub action_update {
74
  my ($self) = @_;
75
  $self->create_or_update;
76
}
77

  
78
sub action_reorder {
79
  my ($self) = @_;
80

  
81
  SL::DB::Buchungsgruppe->reorder_list(@{ $::form->{bg_id} || [] });
82

  
83
  $self->render(\'', { type => 'json' });
84
}
85

  
86
#
87
# filters
88
#
89

  
90
sub check_auth {
91
  $::auth->assert('config');
92
}
93

  
94
sub load_config {
95
  my ($self) = @_;
96

  
97
  $self->config(SL::DB::Buchungsgruppe->new(id => $::form->{id})->load);
98
}
99

  
100
#
101
# helpers
102
#
103

  
104
sub create_or_update {
105
  my ($self) = @_;
106
  my $is_new = !$self->config->id;
107

  
108
  my $params = delete($::form->{config}) || { };
109
  delete $params->{id};
110

  
111
  $self->config->assign_attributes(%{ $params });
112

  
113
  my @errors = $self->config->validate;
114

  
115
  if (@errors) {
116
    flash('error', @errors);
117
    $self->show_form(title => $is_new ? t8('Add taxzone') : t8('Edit taxzone'));
118
    return;
119
  }
120

  
121
  $self->config->save;
122

  
123
  #Save taxzone_charts:
124
  if ($is_new) {
125
    my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted();
126

  
127
    foreach my $tz (@{ $taxzones }) {
128
      my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by_or_create(buchungsgruppen_id => $self->config->id, taxzone_id => $tz->id);
129
      $taxzone_chart->taxzone_id($tz->id);
130
      $taxzone_chart->buchungsgruppen_id($self->config->id);
131
      $taxzone_chart->income_accno_id($::form->{"income_accno_id_" . $tz->id});
132
      $taxzone_chart->expense_accno_id($::form->{"expense_accno_id_" . $tz->id});
133
      $taxzone_chart->save;
134
    }
135
  }
136

  
137
  flash_later('info', $is_new ? t8('The Buchungsgruppe has been created.') : t8('The Buchungsgruppe has been saved.'));
138
  $self->redirect_to(action => 'list');
139
}
140

  
141
1;
SL/Controller/CustomVariableConfig.pm
9 9
use SL::DB::CustomVariableConfig;
10 10
use SL::Helper::Flash;
11 11
use SL::Locale::String;
12
use Data::Dumper;
12 13

  
13 14
use Rose::Object::MakeMethods::Generic (
14 15
  scalar                  => [ qw(config module module_description flags) ],
SL/Controller/Taxzones.pm
1
package SL::Controller::Taxzones;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
#use List::Util qw(first);
8

  
9
use SL::DB::TaxZone;
10
use SL::Helper::Flash;
11
use SL::Locale::String;
12
use SL::DB::Manager::Buchungsgruppe;
13
use SL::DB::Manager::TaxzoneChart;
14
use SL::Controller::ClientConfig;
15

  
16
use Rose::Object::MakeMethods::Generic (
17
  scalar                  => [ qw(config) ],
18
);
19

  
20
__PACKAGE__->run_before('check_auth');
21
__PACKAGE__->run_before('load_config', only => [ qw(edit update) ]); #destroy
22

  
23
#
24
# actions
25
#
26

  
27
sub action_list {
28
  my ($self) = @_;
29

  
30
  my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted();
31

  
32
  $::form->header;
33
  $self->render('taxzones/list',
34
                title    => t8('List of tax zones'),
35
                TAXZONES => $taxzones);
36
}
37

  
38
sub action_new {
39
  my ($self) = @_;
40

  
41
  $self->config(SL::DB::TaxZone->new());
42
  $self->show_form(title => t8('Add taxzone'));
43
}
44

  
45
sub show_form {
46
  my ($self, %params) = @_;
47

  
48
  $self->render('taxzones/form', %params,
49
                BUCHUNGSGRUPPEN => SL::DB::Manager::Buchungsgruppe->get_all_sorted,
50
                ACCOUNTS        => SL::Controller::ClientConfig->init_accounts,
51
                account_label   => sub { "$_[0]{accno}--$_[0]{description}" });
52
}
53

  
54
sub action_edit {
55
  my ($self) = @_;
56

  
57
  $self->show_form(title     => t8('Edit custom variable'),
58
                   CHARTLIST => SL::DB::TaxzoneChart->get_all_accounts_by_taxzone_id($self->config->id));
59
}
60

  
61
sub action_create {
62
  my ($self) = @_;
63

  
64
  $self->config(SL::DB::TaxZone->new());
65
  $self->create_or_update;
66
}
67

  
68
sub action_update {
69
  my ($self) = @_;
70

  
71
  $self->create_or_update;
72
}
73

  
74
sub action_reorder {
75
  my ($self) = @_;
76

  
77
  SL::DB::TaxZone->reorder_list(@{ $::form->{tzone_id} || [] });
78

  
79
  $self->render(\'', { type => 'json' });
80
}
81

  
82
#
83
# filters
84
#
85

  
86
sub check_auth {
87
  $::auth->assert('config');
88
}
89

  
90
sub load_config {
91
  my ($self) = @_;
92

  
93
  $self->config(SL::DB::TaxZone->new(id => $::form->{id})->load);
94
}
95

  
96
#
97
# helpers
98
#
99

  
100
sub create_or_update {
101
  my ($self) = @_;
102
  my $is_new = !$self->config->id;
103

  
104
  my $params = delete($::form->{config}) || { };
105
  delete $params->{id};
106

  
107
  $self->config->assign_attributes(%{ $params });
108

  
109
  my @errors = $self->config->validate;
110

  
111
  if (@errors) {
112
    flash('error', @errors);
113
    $self->show_form(title => $is_new ? t8('Add taxzone') : t8('Edit taxzone'));
114
    return;
115
  }
116

  
117
  $self->config->save;
118

  
119
  #Save taxzone_charts for new taxzones:
120
  if ($is_new) {
121
    my $buchungsgruppen = SL::DB::Manager::Buchungsgruppe->get_all_sorted();
122

  
123
    foreach my $bg (@{ $buchungsgruppen }) {
124
      my $taxzone_chart = SL::DB::Manager::TaxzoneChart->find_by_or_create(buchungsgruppen_id => $bg->id, taxzone_id => $self->config->id);
125

  
126
      $taxzone_chart->taxzone_id($self->config->id);
127
      $taxzone_chart->buchungsgruppen_id($bg->id);
128
      $taxzone_chart->income_accno_id($::form->{"income_accno_id_" . $bg->id});
129
      $taxzone_chart->expense_accno_id($::form->{"expense_accno_id_" . $bg->id});
130
      $taxzone_chart->save;
131
    }
132
  }
133

  
134
  flash_later('info', $is_new ? t8('The taxzone has been created.') : t8('The taxzone has been saved.'));
135
  $self->redirect_to(action => 'list');
136
}
137

  
138
1;
SL/DB/Buchungsgruppe.pm
4 4

  
5 5
use SL::DB::MetaSetup::Buchungsgruppe;
6 6
use SL::DB::Manager::Buchungsgruppe;
7
use SL::DB::Helper::ActsAsList;
7 8

  
8 9
__PACKAGE__->meta->add_relationship(
9 10
  inventory_account => {
......
15 16

  
16 17
__PACKAGE__->meta->initialize;
17 18

  
19
sub validate {
20
  my ($self) = @_;
21

  
22
  my @errors;
23
  push @errors, $::locale->text('The description is missing.') if !$self->description;
24

  
25
  return @errors;
26
}
27

  
28
sub inventory_accno {
29
  my ($self) = @_;
30
  require SL::DB::Manager::Chart;
31
  return SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id) ? SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id)->accno() : undef;
32
}
33

  
34
sub inventory_accno_description {
35
  my ($self) = @_;
36
  require SL::DB::Manager::Chart;
37
  return SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id) ? SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id)->description() : undef;
38
}
18 39

  
19 40
sub income_accno_id {
20 41
  my ($self, $taxzone) = @_;
......
44 65
  return $taxzone_chart->expense_accno if $taxzone_chart;
45 66
}
46 67

  
68
sub taxzonecharts {
69
  my ($self) = @_;
70
  return SL::DB::Manager::TaxzoneChart->get_all(where => [ buchungsgruppen_id => $self->id ]);
71
}
72

  
47 73
1;
48 74
__END__
49 75

  
SL/DB/Manager/TaxZone.pm
1
package SL::DB::Manager::TaxZone;
2

  
3
use strict;
4

  
5
use SL::DB::Helper::Manager;
6
use base qw(SL::DB::Helper::Manager);
7

  
8
use SL::DB::Helper::Paginated;
9
use SL::DB::Helper::Sorted;
10

  
11
sub object_class { 'SL::DB::TaxZone' }
12

  
13
__PACKAGE__->make_manager_methods;
14

  
15
sub _sort_spec {
16
  return ( default => [ 'sortkey', 1 ],
17
           columns => { SIMPLE => 'ALL' } );
18
}
19

  
20
1;
SL/DB/Manager/TaxzoneChart.pm
1
package SL::DB::Manager::TaxzoneChart;
2

  
3
use strict;
4

  
5
use SL::DB::Helper::Manager;
6
use base qw(SL::DB::Helper::Manager);
7

  
8
use SL::DB::Helper::Sorted;
9

  
10
sub object_class { 'SL::DB::TaxzoneChart' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
sub _sort_spec {
15
  return ( default => [ 'taxzone_id', 1 ],
16
           columns => { SIMPLE      => 'ALL',
17
                      });
18
}
19

  
20
1;
SL/DB/MetaSetup/Buchungsgruppe.pm
10 10

  
11 11
__PACKAGE__->meta->columns(
12 12
  description        => { type => 'text' },
13
  id                 => { type => 'integer', not_null => 1, sequence => 'id' },
13 14
  inventory_accno_id => { type => 'integer' },
14 15
  sortkey            => { type => 'integer', not_null => 1 },
15 16
);
SL/DB/MetaSetup/TaxZone.pm
10 10

  
11 11
__PACKAGE__->meta->columns(
12 12
  description => { type => 'text' },
13
  id          => { type => 'integer', not_null => 1 },
13
  id          => { type => 'integer', not_null => 1, sequence => 'id' },
14
  sortkey     => { type => 'integer', not_null => 1 },
14 15
);
15 16

  
16 17
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
SL/DB/TaxZone.pm
6 6
use strict;
7 7

  
8 8
use SL::DB::MetaSetup::TaxZone;
9
use SL::DB::Manager::TaxZone;
10
use SL::DB::Helper::ActsAsList;
9 11

  
10 12
__PACKAGE__->meta->initialize;
11 13

  
12 14
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
13
__PACKAGE__->meta->make_manager_class;
15
#__PACKAGE__->meta->make_manager_class;
16

  
17
sub validate {
18
  my ($self) = @_;
19

  
20
  my @errors;
21
  push @errors, $::locale->text('The description is missing.') if !$self->description;
22

  
23
  return @errors;
24
}
14 25

  
15 26
1;
SL/DB/TaxzoneChart.pm
6 6
use strict;
7 7

  
8 8
use SL::DB::MetaSetup::TaxzoneChart;
9
use SL::DB::Manager::TaxzoneChart;
10
use SL::DB::MetaSetup::Buchungsgruppe;
9 11

  
10 12
__PACKAGE__->meta->initialize;
11 13

  
12 14
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
13
__PACKAGE__->meta->make_manager_class;
15
#__PACKAGE__->meta->make_manager_class;
16

  
17
sub get_all_accounts_by_buchungsgruppen_id {
18
  my ($self, $buchungsgruppen_id) = @_;
19

  
20
  my $all_taxzonecharts = SL::DB::Manager::TaxzoneChart->get_all(where   => [ buchungsgruppen_id => $buchungsgruppen_id ],
21
                                                                 sort_by => 'taxzone_id');
22

  
23
  my %list = ();
24

  
25
  #inventory_accno der Buchungsgruppe:
26
  $list{inventory_accno} = SL::DB::Manager::Buchungsgruppe->find_by(id => $buchungsgruppen_id)->inventory_accno;
27
  $list{inventory_accno_description} = SL::DB::Manager::Buchungsgruppe->find_by(id => $buchungsgruppen_id)->inventory_accno_description;
28

  
29
  foreach my $taxzonechart (@{ $all_taxzonecharts }) {
30
    $list{ $taxzonechart->taxzone_id }{taxzone_chart_id}          = $taxzonechart->id;
31
    $list{ $taxzonechart->taxzone_id }{income_accno}              = $taxzonechart->get_income_accno;
32
    $list{ $taxzonechart->taxzone_id }{expense_accno}             = $taxzonechart->get_expense_accno;
33
    $list{ $taxzonechart->taxzone_id }{income_accno_id}           = $taxzonechart->income_accno_id;
34
    $list{ $taxzonechart->taxzone_id }{expense_accno_id}          = $taxzonechart->expense_accno_id;
35
    $list{ $taxzonechart->taxzone_id }{income_accno_description}  = $taxzonechart->get_income_accno_description;
36
    $list{ $taxzonechart->taxzone_id }{expense_accno_description} = $taxzonechart->get_expense_accno_description;
37
  }
38
  return \%list;
39
}
40

  
41
sub get_all_accounts_by_taxzone_id {
42
  my ($self, $taxzone_id) = @_;
43

  
44
  my $all_taxzonecharts = SL::DB::Manager::TaxzoneChart->get_all(where => [ taxzone_id => $taxzone_id ]);
45

  
46
  my %list = ();
47

  
48
  foreach my $tzchart (@{ $all_taxzonecharts }) {
49
    $list{ $tzchart->buchungsgruppen_id }{taxzone_chart_id}          = $tzchart->id;
50
    $list{ $tzchart->buchungsgruppen_id }{income_accno}              = $tzchart->get_income_accno;
51
    $list{ $tzchart->buchungsgruppen_id }{expense_accno}             = $tzchart->get_expense_accno;
52
    $list{ $tzchart->buchungsgruppen_id }{income_accno_id}           = $tzchart->income_accno_id;
53
    $list{ $tzchart->buchungsgruppen_id }{expense_accno_id}          = $tzchart->expense_accno_id;
54
    $list{ $tzchart->buchungsgruppen_id }{income_accno_description}  = $tzchart->get_income_accno_description;
55
    $list{ $tzchart->buchungsgruppen_id }{expense_accno_description} = $tzchart->get_expense_accno_description;
56
  }
57

  
58
  return \%list;
59
}
60

  
61
sub get_income_accno {
62
  my $self = shift;
63
  require SL::DB::Manager::Chart;
64
  return SL::DB::Manager::Chart->find_by(id => $self->income_accno_id)->accno();
65
}
66

  
67
sub get_expense_accno {
68
  my $self = shift;
69
  require SL::DB::Manager::Chart;
70
  return SL::DB::Manager::Chart->find_by(id => $self->expense_accno_id)->accno();
71
}
72

  
73
sub get_income_accno_description {
74
  my $self = shift;
75
  require SL::DB::Manager::Chart;
76
  return SL::DB::Manager::Chart->find_by(id => $self->income_accno_id)->description();
77
}
78

  
79
sub get_expense_accno_description {
80
  my $self = shift;
81
  require SL::DB::Manager::Chart;
82
  return SL::DB::Manager::Chart->find_by(id => $self->expense_accno_id)->description();
83
}
14 84

  
15 85
1;
bin/mozilla/am.pl
790 790
  $main::lxdebug->leave_sub();
791 791
}
792 792

  
793

  
794
sub add_buchungsgruppe {
795
  $main::lxdebug->enter_sub();
796

  
797
  my $form     = $main::form;
798
  my %myconfig = %main::myconfig;
799
  my $locale   = $main::locale;
800

  
801
  $main::auth->assert('config');
802

  
803
  # $locale->text("Add Buchungsgruppe")
804
  # $locale->text("Edit Buchungsgruppe")
805
  $form->{title} = "Add";
806

  
807
  $form->{callback} = "am.pl?action=add_buchungsgruppe" unless $form->{callback};
808

  
809
  AM->get_buchungsgruppe(\%myconfig, \%$form);
810
  $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
811
  for (my $i = 0; 4 > $i; $i++) {
812
    map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
813
        qw(income expense));
814
  }
815

  
816
  &buchungsgruppe_header;
817
  &form_footer;
818

  
819
  $main::lxdebug->leave_sub();
820
}
821

  
822
sub edit_buchungsgruppe {
823
  $main::lxdebug->enter_sub();
824

  
825
  my $form     = $main::form;
826
  my %myconfig = %main::myconfig;
827

  
828
  $main::auth->assert('config');
829

  
830
  $form->{title} = "Edit";
831

  
832
  AM->get_buchungsgruppe(\%myconfig, \%$form);
833

  
834
  &buchungsgruppe_header;
835

  
836
  &form_footer;
837

  
838
  $main::lxdebug->leave_sub();
839
}
840

  
841
sub list_buchungsgruppe {
842
  $::lxdebug->enter_sub;
843
  $::auth->assert('config');
844

  
845
  AM->buchungsgruppe(\%::myconfig, $::form);
846

  
847
  $::form->{callback} = "am.pl?action=list_buchungsgruppe";
848
  $::form->{title}    = $::locale->text('Buchungsgruppen');
849
  $::form->header;
850

  
851
  print $::form->parse_html_template('am/buchungsgruppe_list', {
852
    swap_link => qq|am.pl?action=swap_buchungsgruppen&|,
853
  });
854

  
855
  $::lxdebug->leave_sub;
856
}
857

  
858
sub buchungsgruppe_header {
859
  $::lxdebug->enter_sub;
860
  $::auth->assert('config');
861

  
862
  # $locale->text('Add Accounting Group')
863
  # $locale->text('Edit Accounting Group')
864
  $::form->{title}    = $::locale->text("$::form->{title} Buchungsgruppe");
865

  
866
  my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
867
  my %acc_type_map = (
868
    IC         => $acc_inventory,
869
    IC_income  => $acc_income,
870
    IC_sale    => $acc_income,
871
    IC_expense => $acc_expense,
872
    IC_cogs    => $acc_expense,
873
  );
874

  
875
  for my $key (keys %acc_type_map) {
876
    for my $ref (@{ $::form->{IC_links}{$key} }) {
877
      $acc_type_map{$key}{$ref->{id}} = $ref;
878
    }
879
  }
880

  
881
  my %sorted_accounts = map {
882
    $_ => [ sort { $a->{accno} cmp $b->{accno} } values %{ $acc_type_map{$_} } ],
883
  } keys %acc_type_map;
884

  
885
  $::form->header;
886
  print $::form->parse_html_template('am/buchungsgruppe_header', {
887
    accounts      => \%sorted_accounts,
888
    account_label => sub { "$_[0]{accno}--$_[0]{description}" },
889
  });
890

  
891
  $::lxdebug->leave_sub;
892
}
893

  
894
sub save_buchungsgruppe {
895
  $main::lxdebug->enter_sub();
896

  
897
  my $form     = $main::form;
898
  my %myconfig = %main::myconfig;
899
  my $locale   = $main::locale;
900

  
901
  $main::auth->assert('config');
902

  
903
  $form->isblank("description", $locale->text('Description missing!'));
904

  
905
  AM->save_buchungsgruppe(\%myconfig, \%$form);
906
  $form->redirect($locale->text('Accounting Group saved!'));
907

  
908
  $main::lxdebug->leave_sub();
909
}
910

  
911
sub delete_buchungsgruppe {
912
  $main::lxdebug->enter_sub();
913

  
914
  my $form     = $main::form;
915
  my %myconfig = %main::myconfig;
916
  my $locale   = $main::locale;
917

  
918
  $main::auth->assert('config');
919

  
920
  AM->delete_buchungsgruppe(\%myconfig, \%$form);
921
  $form->redirect($locale->text('Accounting Group deleted!'));
922

  
923
  $main::lxdebug->leave_sub();
924
}
925

  
926
sub swap_buchungsgruppen {
927
  $main::lxdebug->enter_sub();
928

  
929
  my $form     = $main::form;
930
  my %myconfig = %main::myconfig;
931

  
932
  $main::auth->assert('config');
933

  
934
  AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
935
  list_buchungsgruppe();
936

  
937
  $main::lxdebug->leave_sub();
938
}
939

  
940 793
sub _build_cfg_options {
941 794
  my $form     = $main::form;
942 795
  my %myconfig = %main::myconfig;
locale/de/all
182 182
  'Add picture to text block'   => 'Bild dem Textblock hinzufügen',
183 183
  'Add section'                 => 'Abschnitt hinzufügen',
184 184
  'Add sub function block'      => 'Unterfunktionsblock hinzufügen',
185
  'Add taxzone'                 => 'Steuerzone hinzufügen',
185 186
  'Add text block'              => 'Textblock erfassen',
186 187
  'Add unit'                    => 'Einheit hinzufügen',
187 188
  'Added sections and function blocks: #1' => 'Hinzugefügte Abschnitte und Funktionsblöcke: #1',
......
962 963
  'Edit requirement spec type'  => 'Pflichtenhefttypen bearbeiten',
963 964
  'Edit risk level'             => 'Risikograd bearbeiten',
964 965
  'Edit section #1'             => 'Abschnitt #1 bearbeiten',
966
  'Edit taxzone'                => 'Steuerzone bearbeiten',
965 967
  'Edit templates'              => 'Vorlagen bearbeiten',
966 968
  'Edit text block'             => 'Textblock bearbeiten',
967 969
  'Edit text block \'#1\''      => 'Textblock \'#1\' bearbeiten',
......
1400 1402
  'List of bank collections'    => 'Bankeinzugsliste',
1401 1403
  'List of bank transfers'      => 'Überweisungsliste',
1402 1404
  'List of custom variables'    => 'Liste der benutzerdefinierten Variablen',
1405
  'List of tax zones'           => 'Liste der Steuerzonen',
1403 1406
  'List open SEPA exports'      => 'Noch nicht ausgeführte SEPA-Exporte anzeigen',
1404 1407
  'Load draft'                  => 'Entwurf laden',
1405 1408
  'Load profile'                => 'Profil laden',
......
2303 2306
  'Taxlink_coa'                 => 'Steuerautomatik',
2304 2307
  'Taxnumber'                   => 'Steuernummer',
2305 2308
  'Taxrate missing!'            => 'Prozentsatz fehlt!',
2309
  'Taxzones'                    => 'Steuerzonen',
2306 2310
  'Tel'                         => 'Tel',
2307 2311
  'Tel.'                        => 'Telefon',
2308 2312
  'Telephone'                   => 'Telefon',
......
2547 2551
  'The task server is not running.' => 'Der Task-Server läuft nicht.',
2548 2552
  'The task server was started successfully.' => 'Der Task-Server wurde erfolgreich gestartet.',
2549 2553
  'The task server was stopped successfully.' => 'Der Task-Server wurde erfolgreich beendet.',
2554
  'The taxzone has been created.' => 'Die Steuerzone wurde erstellt.',
2555
  'The taxzone has been saved.' => 'Die Steuerzone wurde gespeichert.',
2550 2556
  'The third way is to download the module from the above mentioned URL and to install the module manually following the installations instructions contained in the source archive.' => 'Die dritte Variante besteht darin, das Paket von der oben genannten URL herunterzuladen und es manuell zu installieren. Beachten Sie dabei die im Paket enthaltenen Installationsanweisungen.',
2551 2557
  'The three columns "make_X", "model_X" and "lastcost_X" with the same number "X" are used to import vendor part numbers and vendor prices.' => 'Die drei Spalten "make_X", "model_X" und "lastcost_X" mit derselben Nummer "X" werden zum Import von Lieferantenartikelnummern und -preisen genutzt.',
2552 2558
  'The title is missing.'       => 'Der Titel fehlt.',
menus/erp.ini
570 570
action=list_account
571 571

  
572 572
[System--Buchungsgruppen]
573
module=am.pl
574
action=list_buchungsgruppe
573
module=controller.pl
574
action=Buchungsgruppen/list
575

  
576
[System--Taxzones]
577
module=controller.pl
578
action=Taxzones/list
575 579

  
576 580
[System--Taxes]
577 581
module=am.pl
sql/Pg-upgrade2/taxzone_default_id.sql
1
-- @tag: taxzone_default_id
2
-- @description: In der Tabelle tax_zones wird die id nun automatisch vergeben.
3
-- @depends: release_3_0_0 convert_taxzone taxzone_charts
4

  
5
ALTER TABLE tax_zones ALTER id SET DEFAULT nextval(('id'::text)::regclass);
sql/Pg-upgrade2/taxzone_sortkey.pl
1
# @tag: taxzone_sortkey
2
# @description: Setzt eine neue Spalte sortkey in der Datenbank, um Steuerzonen sortierbar zu machen.
3
# @depends: taxzone_charts
4
package SL::DBUpgrade2::taxzone_sortkey;
5

  
6
use strict;
7
use utf8;
8

  
9
use SL::DB::Manager::TaxZone;
10

  
11
use parent qw(SL::DBUpgrade2::Base);
12

  
13
sub run {
14
  my ($self) = @_;
15

  
16
  my $query = qq|ALTER TABLE tax_zones ADD COLUMN sortkey INTEGER|;
17
  $self->db_query($query);
18
  $self->dbh->commit;
19

  
20
  my $sortkey = 1;
21
  $query = qq|SELECT * FROM tax_zones ORDER BY id|;
22

  
23
  my $sth = $self->dbh->prepare($query);
24
  $sth->execute || $::form->dberror($query);
25

  
26
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
27
    $self->db_query(qq|UPDATE tax_zones SET sortkey = $sortkey WHERE id = | . $ref->{id});
28
    $sortkey++;
29
  }
30
  $sth->finish;
31

  
32
  $self->dbh->commit;
33

  
34
  $query = qq|ALTER TABLE tax_zones ALTER COLUMN sortkey SET NOT NULL|;
35
  $self->db_query($query);
36

  
37
  return 1;
38
} # end run
39

  
40
1;
templates/webpages/am/buchungsgruppe_header.html
1
[%- USE HTML %]
2
[%- USE L %]
3
[%- USE LxERP %]
4
[%- USE T8 %]
5

  
6
<h1>[% title | html %]</h1>
7

  
8
<form method=post action=am.pl>
9

  
10
<input type=hidden name=id value='[% id %]'>
11
<input type=hidden name=type value=buchungsgruppe>
12

  
13
<table width=100%>
14
  <tr>
15
    <th align=right>[% 'Buchungsgruppe' | $T8 %]</th>
16
    <td><input name=description size=30 value="[% description | html %]"></td>
17
  </tr>
18
[%- IF INSTANCE_CONF.get_inventory_system == 'perpetual' %]
19
  <tr>
20
   <th align=right>[% 'Inventory' | $T8 %]</th>
21
   <td>[% L.select_tag('inventory_accno_id', accounts.IC, title_sub=\account_label, default=invetory_accno_id) %]</td>
22
  </tr>
23
[%- ELSE %]
24
  <tr style='display:none'>
25
    <td>[% L.hidden_tag('inventory_accno_id', inventory_accno_id) %]</td>
26
  </tr>
27
[%- END %]
28
  <tr>
29
    <th align=right>[% 'National Revenues' | $T8 %]</th>
30
    <td>[% L.select_tag('income_accno_id_0', accounts.IC_income, title_sub=\account_label, default=income_accno_id_0) %]</td>
31
  </tr>
32
  <tr>
33
    <th align=right>[% 'National Expenses' | $T8 %]</th>
34
    <td>[% L.select_tag('expense_accno_id_0', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_0) %]</td>
35
  </tr>
36
  <tr>
37
    <th align=right>[% 'Revenues EU with UStId' | $T8 %]</th>
38
    <td>[% L.select_tag('income_accno_id_1', accounts.IC_income, title_sub=\account_label, default=income_accno_id_1) %]</td>
39
  </tr>
40
  <tr>
41
    <th align=right>[% 'Expenses EU with UStId' | $T8 %]</th>
42
    <td>[% L.select_tag('expense_accno_id_1', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_1) %]</td>
43
  </tr>
44
  <tr>
45
    <th align=right>[% 'Revenues EU without UStId' | $T8 %]</th>
46
    <td>[% L.select_tag('income_accno_id_2', accounts.IC_income, title_sub=\account_label, default=income_accno_id_2) %]</td>
47
  </tr>
48
  <tr>
49
    <th align=right>[% 'Expenses EU without UStId' | $T8 %]</th>
50
    <td>[% L.select_tag('expense_accno_id_2', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_2) %]</td>
51
  </tr>
52
  <tr>
53
    <th align=right>[% 'Foreign Revenues' | $T8 %]</th>
54
    <td>[% L.select_tag('income_accno_id_3', accounts.IC_income, title_sub=\account_label, default=income_accno_id_3) %]</td>
55
  </tr>
56
  <tr>
57
    <th align=right>[% 'Foreign Expenses' | $T8 %]</th>
58
    <td>[% L.select_tag('expense_accno_id_3', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_3) %]</td>
59
  </tr>
60
  <td colspan=2><hr size=3 noshade></td>
61
  </tr>
62
</table>
templates/webpages/am/buchungsgruppe_list.html
1
[%- USE HTML %]
2
[%- USE L %]
3
[%- USE LxERP %]
4
[%- USE T8 %]
5

  
6
<h1>[% title | html %]</h1>
7

  
8
<table width=100%>
9
  <tr>
10
  </tr>
11
  <tr height="5"></tr>
12
  <tr>
13
    <td>
14
      <table width=100%>
15
        <tr class=listheading>
16
         <th class="listheading" width="16"><img src="image/up.png" alt="[% 'up' | $T8 %]"></th>
17
         <th class="listheading" width="16"><img src="image/down.png" alt="[% 'down' | $T8 %]"></th>
18
         <th class="listheading" width="40%">[% 'Description' | $T8 %]</th>
19
         <th class=listheading>[% 'Bestandskonto' | $T8 %]</th>
20
         <th class=listheading>[% 'National Revenues' | $T8 %]</th>
21
         <th class=listheading>[% 'National Expenses' | $T8 %]</th>
22
         <th class=listheading>[% 'Revenues EU with UStId' | $T8 %]</th>
23
         <th class=listheading>[% 'Expenses EU with UStId' | $T8 %]</th>
24
         <th class=listheading>[% 'Revenues EU without UStId' | $T8 %]</th>
25
         <th class=listheading>[% 'Expenses EU without UStId' | $T8 %]</th>
26
         <th class=listheading>[% 'Foreign Revenues' | $T8 %]</th>
27
         <th class=listheading>[% 'Foreign Expenses' | $T8 %]</th>
28
        </tr>
29
[%- FOREACH row IN ALL %]
30
        <tr valign=top class=listrow[% loop.count % 2 %]>
31
          <td align="center" valign="center">[% IF !loop.first %]<a href="[% swap_link %]id1=[% row.id %]&id2=[% loop.prev.id %]"><img border="0" src="image/up.png" alt="[% 'up' | $T8 %]"></a>[% ELSE %]&nbsp;[% END %]</td>
32
          <td align="center" valign="center">[% IF !loop.last %]<a href="[% swap_link %]id1=[% row.id %]&id2=[% loop.next.id %]"><img border="0" src="image/down.png" alt="[% 'down' | $T8 %]"></a>[% ELSE %]&nbsp;[% END %]</td>
33
          <td><a href="am.pl?action=edit_buchungsgruppe&id=[%row.id %]&callback=[% callback | html %]">[% row.description | html %]</a></td>
34
          <td align=right>[% row.inventory_accno | html %]</td>
35
          <td align=right>[% row.income_accno_0  | html %]</td>
36
          <td align=right>[% row.expense_accno_0 | html %]</td>
37
          <td align=right>[% row.income_accno_1  | html %]</td>
38
          <td align=right>[% row.expense_accno_1 | html %]</td>
39
          <td align=right>[% row.income_accno_2  | html %]</td>
40
          <td align=right>[% row.expense_accno_2 | html %]</td>
41
          <td align=right>[% row.income_accno_3  | html %]</td>
42
          <td align=right>[% row.expense_accno_3 | html %]</td>
43
        </tr>
44
[%- END %]
45
      </table>
46
    </td>
47
  </tr>
48
  <tr>
49
  <td><hr size=3 noshade></td>
50
  </tr>
51
</table>
52

  
53
<br>
54

  
55
<a href="am.pl?action=add&type=buchungsgruppe&callback=[% HTML.url(callback) %]">[%- LxERP.t8('Add') %]</a>
templates/webpages/buchungsgruppen/form.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1>
2

  
3
<form action="controller.pl" method="post">
4
[%- L.hidden_tag("id", SELF.config.id) %]
5

  
6
<table>
7
  <tr>
8
    <th align="right">[% 'Description' | $T8 %]</th>
9
    <td>[%- L.input_tag("config.description", SELF.config.description) %]</td>
10
  </tr>
11
  <tr>
12
    <th align="right">[% 'Inventory account' | $T8 %]</th>
13
    [%- IF SELF.config.id %]
14
    <td>[%- CHARTLIST.inventory_accno %] -- [%- CHARTLIST.inventory_accno_description %]</td>
15
    [%- ELSE %]
16
    <td>[%- L.select_tag("config.inventory_accno_id", ACCOUNTS.ic, title_sub=\account_label, default=SELF.config.inventory_accno_id) %]</td>
17
    [%- END %]
18
  </tr>
19
[%- FOREACH tz = TAXZONES %]
20
  <tr>
21
    <th align="right">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
22
    [%- IF SELF.config.id %]
23
    <td>[% CHARTLIST.${tz.id}.income_accno %] -- [% CHARTLIST.${tz.id}.income_accno_description %]</td>
24
    [%- ELSE %]
25
    <td>[%- L.select_tag('income_accno_id_' _ tz.id, ACCOUNTS.ic_income, title_sub=\account_label, default=CHARTLIST.${tz.id}.income_accno_id) %]</td>
26
    [%- END %]
27
  </tr>
28
  <tr>
29
    <th align="right">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>
30
    [%- IF SELF.config.id %]
31
    <td>[% CHARTLIST.${tz.id}.expense_accno %] -- [% CHARTLIST.${tz.id}.expense_accno_description %]</td>
32
    [%- ELSE %]
33
    <td>[%- L.select_tag('expense_accno_id_' _ tz.id, ACCOUNTS.ic_expense, title_sub=\account_label, default=CHARTLIST.${tz.id}.expense_accno_id) %]</td>
34
    [%- END %]
35
  </tr>
36
[%- END %]
37
</table>
38

  
39
 <p>
40
  [% L.hidden_tag("action", "Buchungsgruppen/dispatch") %]
41
  [% L.submit_tag("action_" _  (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
42
  <a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a>
43
 </p>
44

  
45
 <hr>
46

  
47
<script type="text/javascript">
48
<!--
49
function check_prerequisites() {
50
  if ($('#config_description').val() === "") {
51
    alert(kivi.t8('The description is missing.'));
52
    return false;
53
  }
54

  
55
  return true;
56
}
57
-->
58
</script>
59
</form>
templates/webpages/buchungsgruppen/list.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %]
2

  
3
<h1>[% title %]</h1>
4

  
5
<p>
6
 <table width="100%" id="buchungsgruppen_list">
7
  <thead>
8
   <tr class="listheading">
9
    <th align="center" width="1%"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
10
    <th width="20%">[% 'Description' | $T8 %]</th>
11
    <th width="20%">[% 'Inventory' | $T8 %]</th>
12
     [%- FOREACH tz = TAXZONES %]
13
        <th width="20%">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
14
        <th width="20%">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>
15
     [%- END %]
16
   </tr>
17
  </thead>
18

  
19
  <tbody>
20
   [%- FOREACH bg = BUCHUNGSGRUPPEN %]
21
    <tr class="listrow" id="bg_id_[% bg.id %]">
22
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
23
     <td><a href="[% SELF.url_for(action='edit', id=bg.id) %]">[% HTML.escape(bg.description) %]</a></td>
24
     <td>[% HTML.escape(CHARTLIST.${bg.id}.inventory_accno) %]</td>
25
     [%- FOREACH tz = TAXZONES %]
26
        <td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.income_accno) %]</td>
27
        <td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.expense_accno) %]</td>
28
     [%- END %]
29
   [%- END %]
30
  </tbody>
31
 </table>
32
</p>
33

  
34
<hr height="3">
35

  
36
[% L.sortable_element('#buchungsgruppen_list tbody', url=SELF.url_for(action='reorder'), with='bg_id') %]
37

  
38
<p>
39
 <a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a>
40
</p>
41

  
templates/webpages/taxzones/form.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1>
2

  
3
<form action="controller.pl" method="post">
4
[%- L.hidden_tag("id", SELF.config.id) %]
5

  
6
<table>
7
  <tr>
8
    <th align="right">[% 'Description' | $T8 %]</th>
9
    <td>[%- L.input_tag("config.description", SELF.config.description) %]</td>
10
  </tr>
11
[%- FOREACH bg = BUCHUNGSGRUPPEN %]
12
  <tr>
13
    <th align="right">[% 'Revenue' | $T8 %] [% HTML.escape(bg.description) %]</th>
14
    [%- IF SELF.config.id %]
15
    <td>[% CHARTLIST.${bg.id}.income_accno %] -- [% CHARTLIST.${bg.id}.income_accno_description %]</td>
16
    [%- ELSE %]
17
    <td>[%- L.select_tag('income_accno_id_' _ bg.id, ACCOUNTS.ic_income, title_sub=\account_label, default=CHARTLIST.${bg.id}.income_accno_id) %]</td>
18
    [%- END %]
19
  </tr>
20
  <tr>
21
    <th align="right">[% 'Expense' | $T8 %] [% HTML.escape(bg.description) %]</th>
22
    [%- IF SELF.config.id %]
23
    <td>[% CHARTLIST.${bg.id}.expense_accno %] -- [% CHARTLIST.${bg.id}.expense_accno_description %]</td>
24
    [%- ELSE %]
25
    <td>[%- L.select_tag('expense_accno_id_' _ bg.id, ACCOUNTS.ic_expense, title_sub=\account_label, default=CHARTLIST.${bg.id}.expense_accno_id) %]</td>
26
    [%- END %]
27
  </tr>
28
[%- END %]
29
</table>
30

  
31
 <p>
32
  [% L.hidden_tag("action", "Taxzones/dispatch") %]
33
  [% L.submit_tag("action_" _  (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
34
  <a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a>
35
 </p>
36

  
37
 <hr>
38

  
39
<script type="text/javascript">
40
<!--
41
function check_prerequisites() {
42
  if ($('#config_description').val() === "") {
43
    alert(kivi.t8('The description is missing.'));
44
    return false;
45
  }
46

  
47
  return true;
48
}
49
-->
50
</script>
51
</form>
templates/webpages/taxzones/list.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %]
2

  
3
<h1>[% title %]</h1>
4

  
5
<p>
6
 <table width="100%" id="taxzone_list">
7
  <thead>
8
   <tr class="listheading">
9
    <th align="center" width="1%"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
10
    <th>[% 'Description' | $T8 %]</th>
11
   </tr>
12
  </thead>
13

  
14
  <tbody>
15
   [%- FOREACH tz = TAXZONES %]
16
    <tr class="listrow" id="tzone_id_[% tz.id %]">
17
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
18
     <td><a href="[% SELF.url_for(action='edit', id=tz.id) %]">[% HTML.escape(tz.description) %]</a></td>
19
    </tr>
20
   [%- END %]
21
  </tbody>
22
 </table>
23
</p>
24

  
25
<hr height="3">
26

  
27
[% L.sortable_element('#taxzone_list tbody', url=SELF.url_for(action='reorder'), with='tzone_id') %]
28

  
29
<p>
30
 <a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a>
31
</p>
32

  

Auch abrufbar als: Unified diff