Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision da311bca

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID da311bca6dc1e57ed00c251fbec0141aac27f579
  • Vorgänger cf0f9e1d
  • Nachfolger 71e82116

am/buchungsgruppen_header auf template umgeschrieben

Unterschiede anzeigen:

bin/mozilla/am.pl
847 847
}
848 848

  
849 849
sub buchungsgruppe_header {
850
  $main::lxdebug->enter_sub();
851

  
852
  my $form     = $main::form;
853
  my $locale   = $main::locale;
854

  
855
  $main::auth->assert('config');
856

  
857
  $form->{title}    = $locale->text("$form->{title} Buchungsgruppe");
850
  $::lxdebug->enter_sub;
851
  $::auth->assert('config');
858 852

  
859 853
  # $locale->text('Add Accounting Group')
860 854
  # $locale->text('Edit Accounting Group')
855
  $::form->{title}    = $::locale->text("$::form->{title} Buchungsgruppe");
861 856

  
862 857
  my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {});
863 858
  my %acc_type_map = (
864
    "IC" => $acc_inventory,
865
    "IC_income" => $acc_income,
866
    "IC_sale" => $acc_income,
867
    "IC_expense" => $acc_expense,
868
    "IC_cogs" => $acc_expense,
869
    );
859
    IC         => $acc_inventory,
860
    IC_income  => $acc_income,
861
    IC_sale    => $acc_income,
862
    IC_expense => $acc_expense,
863
    IC_cogs    => $acc_expense,
864
  );
870 865

  
871
  foreach my $key (keys(%acc_type_map)) {
872
    foreach my $ref (@{ $form->{IC_links}{$key} }) {
873
      $acc_type_map{$key}->{$ref->{"id"}} = $ref;
866
  for my $key (keys %acc_type_map) {
867
    for my $ref (@{ $::form->{IC_links}{$key} }) {
868
      $acc_type_map{$key}{$ref->{id}} = $ref;
874 869
    }
875 870
  }
876 871

  
877
  foreach my $type (qw(IC IC_income IC_expense)) {
878
    $form->{"select$type"} =
879
      join("",
880
           map({ "<option value=$_->{id} $_->{selected}>" .
881
                   "$_->{accno}--" . H($_->{description}) . "</option>" }
882
               sort({ $a->{"accno"} cmp $b->{"accno"} }
883
                    values(%{$acc_type_map{$type}}))));
884
  }
885

  
886
  if ($form->{id}) {
887
    $form->{selectIC} =~ s/selected//g;
888
    $form->{selectIC} =~ s/ value=\Q$form->{inventory_accno_id}\E/  value=$form->{inventory_accno_id} selected/;
889
    $form->{selectIC_income} =~ s/selected//g;
890
    $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_0}\E/  value=$form->{income_accno_id_0} selected/;
891
    $form->{selectIC_expense} =~ s/selected//g;
892
    $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/  value=$form->{expense_accno_id_0} selected/;
893
  }
894

  
895
  my $linkaccounts;
896
  if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) { }
897
    $linkaccounts = qq|
898
               <tr>
899
                <th align=right>| . $locale->text('Inventory') . qq|</th>
900
                <td><select name=inventory_accno_id>$form->{selectIC}</select></td>
901
                <input name=selectIC type=hidden value="$form->{selectIC}">
902
              </tr>|;
903
  } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) {
904
    # don't allow choice of inventory accno and don't show that line
905
    $linkaccounts = qq|
906
                <input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
907
  };
908

  
909

  
910
  $linkaccounts .= qq|
911
              <tr>
912
                <th align=right>| . $locale->text('National Revenues') . qq|</th>
913
                <td><select name=income_accno_id_0>$form->{selectIC_income}</select></td>
914
              </tr>
915
              <tr>
916
                <th align=right>| . $locale->text('National Expenses') . qq|</th>
917
                <td><select name=expense_accno_id_0>$form->{selectIC_expense}</select></td>
918
              </tr>|;
919
  if ($form->{id}) {
920
    $form->{selectIC_income} =~ s/selected//g;
921
    $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_1}\E/  value=$form->{income_accno_id_1} selected/;
922
    $form->{selectIC_expense} =~ s/selected//g;
923
    $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_1}\E/  value=$form->{expense_accno_id_1} selected/;
924
  }
925
  $linkaccounts .= qq|              <tr>
926
                <th align=right>| . $locale->text('Revenues EU with UStId') . qq|</th>
927
                <td><select name=income_accno_id_1>$form->{selectIC_income}</select></td>
928
              </tr>
929
              <tr>
930
                <th align=right>| . $locale->text('Expenses EU with UStId') . qq|</th>
931
                <td><select name=expense_accno_id_1>$form->{selectIC_expense}</select></td>
932
              </tr>|;
933

  
934
  if ($form->{id}) {
935
    $form->{selectIC_income} =~ s/selected//g;
936
    $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_2}\E/  value=$form->{income_accno_id_2} selected/;
937
    $form->{selectIC_expense} =~ s/selected//g;
938
    $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_2}\E/  value=$form->{expense_accno_id_2} selected/;
939
  }
940

  
941
  $linkaccounts .= qq|              <tr>
942
                <th align=right>| . $locale->text('Revenues EU without UStId') . qq|</th>
943
                <td><select name=income_accno_id_2>$form->{selectIC_income}</select></td>
944
              </tr>
945
              <tr>
946
                <th align=right>| . $locale->text('Expenses EU without UStId') . qq|</th>
947
                <td><select name=expense_accno_id_2>$form->{selectIC_expense}</select></td>
948
              </tr>|;
949

  
950
  if ($form->{id}) {
951
    $form->{selectIC_income} =~ s/selected//g;
952
    $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_3}\E/  value=$form->{income_accno_id_3} selected/;
953
    $form->{selectIC_expense} =~ s/selected//g;
954
    $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_3}\E/  value=$form->{expense_accno_id_3} selected/;
955
  }
956

  
957
  $linkaccounts .= qq|              <tr>
958
                <th align=right>| . $locale->text('Foreign Revenues') . qq|</th>
959
                <td><select name=income_accno_id_3>$form->{selectIC_income}</select></td>
960
              </tr>
961
              <tr>
962
                <th align=right>| . $locale->text('Foreign Expenses') . qq|</th>
963
                <td><select name=expense_accno_id_3>$form->{selectIC_expense}</select></td>
964
              </tr>
965
|;
966

  
967

  
968
  $form->header;
969

  
970
  print qq|
971
<body>
972

  
973
<form method=post action=am.pl>
872
  my %sorted_accounts = map {
873
    $_ => [ sort { $a->{accno} cmp $b->{accno} } values %{ $acc_type_map{$_} } ],
874
  } keys %acc_type_map;
974 875

  
975
<input type=hidden name=id value=$form->{id}>
976
<input type=hidden name=type value=buchungsgruppe>
977

  
978
<table width=100%>
979
  <tr>
980
    <th class=listtop colspan=2>$form->{title}</th>
981
  </tr>
982
  <tr height="5"></tr>
983
  <tr>
984
    <th align=right>| . $locale->text('Buchungsgruppe') . qq|</th>
985
    <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
986
  <tr>
987
  $linkaccounts
988
  <td colspan=2><hr size=3 noshade></td>
989
  </tr>
990
</table>
991
|;
876
  $::form->header;
877
  print $::form->parse_html_template('am/buchungsgruppe_header', {
878
    accounts      => \%sorted_accounts,
879
    account_label => sub { "$_[0]{accno}--$_[0]{description}" },
880
  });
992 881

  
993
  $main::lxdebug->leave_sub();
882
  $::lxdebug->leave_sub;
994 883
}
995 884

  
996 885
sub save_buchungsgruppe {
templates/webpages/am/buchungsgruppe_header.html
1
[%- USE HTML %]
2
[%- USE L %]
3
[%- USE LxERP %]
4
[%- USE T8 %]
5
<body>
6

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

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

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

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

Auch abrufbar als: Unified diff