Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1123673

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

  • ID d1123673cfe71c596e4518f8fd1f93916010717d
  • Vorgänger 796598ed
  • Nachfolger 750ac970

gl::form_header auf template umgeschrieben

Unterschiede anzeigen:

bin/mozilla/gl.pl
849 849
}
850 850

  
851 851
sub form_header {
852
  my ($init) = @_;
853
  $main::lxdebug->enter_sub();
854

  
855
  $main::auth->assert('general_ledger');
852
  $::lxdebug->enter_sub;
853
  $::auth->assert('general_ledger');
856 854

  
857
  my $form     = $main::form;
858
  my %myconfig = %main::myconfig;
859
  my $locale   = $main::locale;
855
  my ($init) = @_;
860 856

  
861
  my @old_project_ids = ();
862
  map({ push(@old_project_ids, $form->{"project_id_$_"})
863
          if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
857
  my @old_project_ids = grep { $_ } map{ $::form->{"project_id_$_"} } 1..$::form->{rowcount};
864 858

  
865
  $form->get_lists("projects"  => { "key"       => "ALL_PROJECTS",
859
  $::form->get_lists("projects"  => { "key"       => "ALL_PROJECTS",
866 860
                                    "all"       => 0,
867 861
                                    "old_id"    => \@old_project_ids },
868 862
                   "charts"    => { "key"       => "ALL_CHARTS",
869
                                    "transdate" => $form->{transdate} },
863
                                    "transdate" => $::form->{transdate} },
870 864
                   "taxcharts" => "ALL_TAXCHARTS");
871 865

  
872
  GL->get_chart_balances('charts' => $form->{ALL_CHARTS});
873

  
874
  my $title      = $form->{title};
875
  $form->{title} = $locale->text("$title General Ledger Transaction");
876
  my $readonly   = ($form->{id}) ? "readonly" : "";
877

  
878
  my $show_details_checked   = $form->{show_details}   ? "checked" : '';
879
  my $ob_transaction_checked = $form->{ob_transaction} ? "checked" : '';
880
  my $cb_transaction_checked = $form->{cb_transaction} ? "checked" : '';
866
  GL->get_chart_balances('charts' => $::form->{ALL_CHARTS});
881 867

  
868
  my $title      = $::form->{title};
869
  $::form->{title} = $::locale->text("$title General Ledger Transaction");
882 870
  # $locale->text('Add General Ledger Transaction')
883 871
  # $locale->text('Edit General Ledger Transaction')
884 872

  
885
  map { $form->{$_} =~ s/\"/"/g }
886
    qw(reference description chart taxchart);
887

  
888
  $form->{javascript} = qq|<script type="text/javascript">
889
  <!--
890
  function setTaxkey(row) {
891
    var accno  = document.getElementById('accno_' + row);
892
    var taxkey = accno.options[accno.selectedIndex].value;
893
    var reg = /--([0-9]*)/;
894
    var found = reg.exec(taxkey);
895
    var index = found[1];
896
    index = parseInt(index);
897
    var tax = 'taxchart_' + row;
898
    for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
899
      var reg2 = new RegExp("^"+ index, "");
900
      if (reg2.exec(document.getElementById(tax).options[i].value)) {
901
        document.getElementById(tax).options[i].selected = true;
902
        break;
903
      }
904
    }
905
  };
873
  map { $::form->{$_} =~ s/\"/&quot;/g }
874
    qw(chart taxchart);
906 875

  
907
  function copy_debit_to_credit() {
908
    var txt = document.getElementsByName('debit_1')[0].value;
909
    document.getElementsByName('credit_2')[0].value = txt;
910
  };
911
  //-->
912
  </script>
913
  <script type="text/javascript" src="js/show_form_details.js"></script>
914
  <script type="text/javascript" src="js/jquery.js"></script>
915
|;
916

  
917
  $form->{selectdepartment} =~ s/ selected//;
918
  $form->{selectdepartment} =~
919
    s/option>\Q$form->{department}\E/option selected>$form->{department}/;
920

  
921
  my $description;
922
  if ((my $rows = $form->numtextrows($form->{description}, 50)) > 1) {
923
    $description =
924
      qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
925
  } else {
926
    $description =
927
      qq|<input name=description size=50 value="$form->{description}" $readonly>|;
928
  }
929

  
930
  my $taxincluded = ($form->{taxincluded}) ? "checked" : "";
876
  $::form->{selectdepartment} =~ s/ selected//;
877
  $::form->{selectdepartment} =~
878
    s/option>\Q$::form->{department}\E/option selected>$::form->{department}/;
931 879

  
932 880
  if ($init) {
933
    $taxincluded = "checked";
934
  }
935

  
936
  my $department;
937
  $department = qq|
938
        <tr>
939
          <th align=right nowrap>| . $locale->text('Department') . qq|</th>
940
          <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
941
          <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
942
        </tr>
943
| if $form->{selectdepartment};
944
  if ($init) {
945
    $form->{fokus} = "gl.reference";
946
  } else {
947
    $form->{fokus} = qq|gl.accno_$form->{rowcount}|;
948
  }
949

  
950
  # use JavaScript Calendar or not
951
  $form->{jsscript} = 1;
952
  my $jsscript = "";
953
  my ($button1, $button2);
954
  if ($form->{jsscript}) {
955

  
956
    # with JavaScript Calendar
957
    $button1 = qq|
958
       <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\">
959
       <input type=button name=transdate id="trigger1" value=|
960
      . $locale->text('button') . qq|></td>
961
       |;
962

  
963
    #write Trigger
964
    $jsscript =
965
      Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1");
966
  } else {
967

  
968
    # without JavaScript Calendar
969
    $button1 =
970
      qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\"></td>|;
971
  }
972

  
973
  $form->{previous_id}     ||= "--";
974
  $form->{previous_gldate} ||= "--";
975

  
976
  $jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js');
977

  
978
  $form->header;
979

  
980
  print qq|
981
<body onLoad="focus()">
982

  
983
<script type="text/javascript" src="js/follow_up.js"></script>
984

  
985
<form method=post name="gl" action=gl.pl>
986
|;
987

  
988
  $form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate));
989

  
990
  print qq|
991
<input type=hidden name=title value="$title">
992

  
993
<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|">
994
<input type="hidden" name="follow_up_trans_type_1" value="gl_transaction">
995
<input type="hidden" name="follow_up_trans_info_1" value="| . H($form->{id}) . qq|">
996
<input type="hidden" name="follow_up_rowcount" value="1">
997

  
998
<table width=100%>
999
  <tr>
1000
    <th class=listtop>$form->{title}</th>
1001
  </tr>| .
1002

  
1003
  ($form->{saved_message} ? qq|
1004
  <tr>
1005
    <td>$form->{saved_message}</th>
1006
  </tr>| : '') .
1007

  
1008
qq|
1009
  <tr height="5"></tr>
1010
  <tr>
1011
    <td>
1012
      <table width=100%>
1013
        <tr>
1014
          <td colspan="6" align="left">|
1015
    . $locale->text("Previous transnumber text")
1016
    . " $form->{previous_id} "
1017
    . $locale->text("Previous transdate text")
1018
    . " $form->{previous_gldate}"
1019
    . qq|</td>
1020
        </tr>
1021
        <tr>
1022
          <th align=right>| . $locale->text('Reference') . qq|</th>
1023
          <td><input name=reference size=20 value="$form->{reference}" $readonly></td>
1024
          <td align=left>
1025
            <table>
1026
              <tr>
1027
                <th align=right nowrap>| . $locale->text('Date') . qq|</th>
1028
                $button1
1029
              </tr>
1030
            </table>
1031
          </td>
1032
        </tr>|;
1033
  if ($form->{id}) {
1034
    print qq|
1035
        <tr>
1036
          <th align=right>| . $locale->text('Belegnummer') . qq|</th>
1037
          <td><input name=id size=20 value="$form->{id}" $readonly></td>
1038
          <td align=left>
1039
          <table>
1040
              <tr>
1041
                <th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
1042
                <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly onBlur=\"check_right_date_format(this)\"></td>
1043
              </tr>
1044
            </table>
1045
          </td>
1046
        </tr>|;
1047
  }
1048
  print qq|
1049
        $department|;
1050
  if ($form->{id}) {
1051
    print qq|
1052
        <tr>
1053
          <th align=right width=1%>| . $locale->text('Description') . qq|</th>
1054
          <td width=1%>$description</td>
1055
          <td>
1056
            <table>
1057
              <tr>
1058
                <th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
1059
                <td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
1060
              </tr>
1061
            </table>
1062
         </td>
1063
          <td align=left>
1064
            <table width=100%>
1065
              <tr>
1066
                <th align=right width=50%>| . $locale->text('Mitarbeiter') . qq|</th>
1067
                <td align=left><input name=employee size=20  value="| . H($form->{employee}) . qq|" readonly></td>
1068
              </tr>
1069
            </table>
1070
          </td>
1071
        </tr>|;
881
    $::form->{fokus} = "gl.reference";
882
    $::form->{taxincluded} = "1";
1072 883
  } else {
1073
    print qq|
1074
        <tr>
1075
          <th align=left width=1%>| . $locale->text('Description') . qq|</th>
1076
          <td width=1%>$description</td>
1077
          <td>
1078
            <table>
1079
              <tr>
1080
                <th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
1081
                <td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
1082
              </tr>
1083
            </table>
1084
         </td>
1085
        </tr>|;
884
    $::form->{fokus} = qq|gl.accno_$::form->{rowcount}|;
1086 885
  }
1087 886

  
1088
  print qq|
1089
      <tr>
1090
      <tr><td colspan=4><table><tr>
1091
       <td>
1092
        | . $locale->text('OB Transaction') . qq|<input type="checkbox" name="ob_transaction" value="1" $ob_transaction_checked>
1093
       </td>
1094
       <td>
1095
        | . $locale->text('CB Transaction') . qq|<input type="checkbox" name="cb_transaction" value="1" $cb_transaction_checked>
1096
       </td>
1097
      </tr></table></td></tr>
1098
      <tr>
1099
       <td width="1%" align="right" nowrap>| . $locale->text('Show details') . qq|</td>
1100
       <td width="1%"><input type="checkbox" onclick="show_form_details();" name="show_details" value="1" $show_details_checked></td>
1101
      </tr>|;
887
  $::form->{previous_id}     ||= "--";
888
  $::form->{previous_gldate} ||= "--";
1102 889

  
1103
  print qq|
1104
      <tr>
1105
      <td colspan=4>
1106
          <table width=100%>
1107
           <tr class=listheading>
1108
          <th class=listheading style="width:15%">|
1109
    . $locale->text('Account') . qq|</th>
1110
          <th class=listheading style="width:10%">| . $locale->text('Chart balance') . qq|</th>
1111
          <th class=listheading style="width:10%">|
1112
    . $locale->text('Debit') . qq|</th>
1113
          <th class=listheading style="width:10%">|
1114
    . $locale->text('Credit') . qq|</th>
1115
          <th class=listheading style="width:10%">|
1116
    . $locale->text('Tax') . qq|</th>
1117
          <th class=listheading style="width:5%">|
1118
    . $locale->text('Taxkey') . qq|</th>|;
1119

  
1120
  if ($form->{show_details}) {
1121
    print qq|
1122
          <th class=listheading style="width:20%">| . $locale->text('Source') . qq|</th>
1123
          <th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
1124
          <th class=listheading style="width:20%">| . $locale->text('Project Number') . qq|</th>
1125
|;
1126
  }
1127

  
1128
  print qq|
1129
        </tr>
890
  $::form->header;
891
  print $::form->parse_html_template('gl/form_header', {
892
    hide_title => $title,
893
  });
1130 894

  
1131
$jsscript
1132
|;
1133
  $main::lxdebug->leave_sub();
895
  $::lxdebug->leave_sub;
1134 896

  
1135 897
}
1136 898

  
templates/webpages/gl/form_header.html
1
[%- USE HTML %]
2
[%- USE LxERP %]
3
[%- USE T8 %]
4
[%- USE L %]
5
<body onLoad="focus()">
6

  
7
<script type="text/javascript">
8
  <!--
9
  function setTaxkey(row) {
10
    var accno  = document.getElementById('accno_' + row);
11
    var taxkey = accno.options[accno.selectedIndex].value;
12
    var reg = /--([0-9]*)/;
13
    var found = reg.exec(taxkey);
14
    var index = found[1];
15
    index = parseInt(index);
16
    var tax = 'taxchart_' + row;
17
    for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
18
      var reg2 = new RegExp("^"+ index, "");
19
      if (reg2.exec(document.getElementById(tax).options[i].value)) {
20
        document.getElementById(tax).options[i].selected = true;
21
        break;
22
      }
23
    }
24
  };
25

  
26
  function copy_debit_to_credit() {
27
    var txt = document.getElementsByName('debit_1')[0].value;
28
    document.getElementsByName('credit_2')[0].value = txt;
29
  };
30
  //-->
31
  </script>
32
  <script type="text/javascript" src="js/show_form_details.js"></script>
33
<script type="text/javascript" src="js/follow_up.js"></script>
34

  
35
<form method=post name="gl" action=gl.pl>
36

  
37
[% FOREACH name IN [ 'id', 'closedto', 'locked', 'storno', 'storno_id', 'previous_id', 'previous_gldate' ] %]
38
[% L.hidden_tag(name, $name) %]
39
[%- END %]
40

  
41
<input type=hidden name=title value="[% hide_title | html %]">
42

  
43
<input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">
44
<input type="hidden" name="follow_up_trans_type_1" value="gl_transaction">
45
<input type="hidden" name="follow_up_trans_info_1" value="[% id | html %]">
46
<input type="hidden" name="follow_up_rowcount" value="1">
47

  
48
<table width=100%>
49
  <tr>
50
    <th class=listtop>[% title | html %]</th>
51
  </tr>
52
[%- IF saved_message %]
53
  <tr>
54
    <td>[% saved_message | html %]</th>
55
  </tr>
56
[%- END %]
57

  
58
  <tr height="5"></tr>
59
  <tr>
60
    <td>
61
      <table width=100%>
62
        <tr>
63
          <td colspan="6" align="left">[% 'Previous transnumber text' | $T8 %] [% previous_id  %] . [% 'Previous transdate text' | $T8 %] [% previous_gldate %]</td>
64
        </tr>
65
        <tr>
66
          <th align=right>[% 'Reference' | $T8 %]</th>
67
          <td>[% L.input_tag('reference', reference,  size=20, readonly=id) %]</td>
68
          <td align=left>
69
            <table>
70
              <tr>
71
                <th align=right width=50% nowrap>[% 'Date' | $T8 %]</th>
72
                <td>[% L.date_tag('transdate', transdate, readonly=id) %]</td>
73
              </tr>
74
            </table>
75
          </td>
76
        </tr>
77
[%- IF id %]
78
        <tr>
79
          <th align=right>[% 'Belegnummer' | $T8 %]</th>
80
          <td>[% L.input_tag('id', id,  size=20, readonly=id) %]</td>
81
          <td align=left>
82
          <table>
83
              <tr>
84
                <th align=right width=50%>[% 'Buchungsdatum' | $T8 %]</th>
85
                <td align=left>[% L.date_tag('gldate', gldate, readonly=id) %]</td>
86
              </tr>
87
            </table>
88
          </td>
89
        </tr>
90
[%- END %]
91

  
92
[%- IF selectdepartment %]
93
        <tr>
94
          <th align=right nowrap>[% 'Department' | $T8 %]</th>
95
          <td colspan=3><select name=department>[% selectdepartment %]</select></td>
96
          <input type=hidden name=selectdepartment value="[% selectdepartment | html %]">
97
        </tr>
98
[%- END %]
99

  
100
        <tr>
101
          <th align=right width=1%>[% 'Description' | $T8 %]</th>
102
          <td width=1%>[% L.areainput_tag('description', description, cols=50, readonly=id) %]</td>
103
          <td>
104
            <table>
105
              <tr>
106
                <th align=left>[% 'MwSt. inkl.' | $T8 %]</th>
107
                <td>[% L.checkbox_tag('taxincluded', checked=taxincluded) %]</td>
108
              </tr>
109
            </table>
110
         </td>
111
[%- IF id %]
112
          <td align=left>
113
            <table width=100%>
114
              <tr>
115
                <th align=right width=50%>[% 'Mitarbeiter' | $T8 %]</th>
116
                <td align=left>[% L.input_tag('employee', employee, size=20, readonly=id) %]</td>
117
              </tr>
118
            </table>
119
          </td>
120
[%- END %]
121
        </tr>
122

  
123
      <tr>
124
       <td colspan=4>
125
        <table>
126
         <tr>
127
          <td>[% 'OB Transaction' | $T8 %] [% L.checkbox_tag('ob_transaction' checked=ob_transaction) %]</td>
128
          <td>[% 'CB Transaction' | $T8 %] [% L.checkbox_tag('cb_transaction' checked=cb_transaction) %]</td>
129
         </tr>
130
        </table>
131
       </td>
132
      </tr>
133
      <tr>
134
       <td width="1%" align="right" nowrap>[% 'Show details' | $T8 %]</td>
135
       <td width="1%">[% L.checkbox_tag('show_details', checked=show_details, onclick='show_form_details();') %]</td>
136
      </tr>
137

  
138
      <tr>
139
      <td colspan=4>
140
          <table width=100%>
141
           <tr class=listheading>
142
          <th class=listheading style="width:15%">[% 'Account' | $T8 %]</th>
143
          <th class=listheading style="width:10%">[% 'Chart balance' | $T8 %]</th>
144
          <th class=listheading style="width:10%">[% 'Debit' | $T8 %]</th>
145
          <th class=listheading style="width:10%">[% 'Credit' | $T8 %]</th>
146
          <th class=listheading style="width:10%">[% 'Tax' | $T8 %]</th>
147
          <th class=listheading style="width:5%">[% 'Taxkey' | $T8 %]</th>
148

  
149
[%- IF show_details %]
150
          <th class=listheading style="width:20%">[% 'Source' | $T8 %]</th>
151
          <th class=listheading style="width:20%">[% 'Memo' | $T8 %]</th>
152
          <th class=listheading style="width:20%">[% 'Project Number' | $T8 %]</th>
153
[%- END %]
154

  
155
        </tr>
156

  
157
[%- PROCESS 'gl/form_header_chart_balances_js.html' %]

Auch abrufbar als: Unified diff