Revision 913fe339
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
bin/mozilla/gl.pl | ||
---|---|---|
81 | 81 |
# we use this only to set a default date |
82 | 82 |
GL->transaction(\%myconfig, \%$form); |
83 | 83 |
|
84 |
map { |
|
85 |
$chart .= |
|
86 |
"<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>" |
|
87 |
} @{ $form->{chart} }; |
|
88 | 84 |
map { |
89 | 85 |
$tax .= |
90 | 86 |
qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} | |
91 | 87 |
. ($_->{rate} * 100) . qq| %| |
92 | 88 |
} @{ $form->{TAX} }; |
93 | 89 |
|
94 |
$form->{chart} = $chart; |
|
95 |
$form->{chartinit} = $chart; |
|
96 | 90 |
$form->{rowcount} = 2; |
97 | 91 |
|
98 |
$form->{debitchart} = $chart; |
|
99 |
$form->{creditchart} = $chart; |
|
100 |
$form->{taxchart} = $tax; |
|
101 |
|
|
102 | 92 |
$form->{debit} = 0; |
103 | 93 |
$form->{credit} = 0; |
104 | 94 |
$form->{tax} = 0; |
... | ... | |
123 | 113 |
$lxdebug->enter_sub(); |
124 | 114 |
|
125 | 115 |
GL->transaction(\%myconfig, \%$form); |
126 |
map { |
|
127 |
$chart .= |
|
128 |
"<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>" |
|
129 |
} @{ $form->{chart} }; |
|
130 | 116 |
|
131 | 117 |
map { |
132 | 118 |
$tax .= |
... | ... | |
134 | 120 |
. ($_->{rate} * 100) . qq| %| |
135 | 121 |
} @{ $form->{TAX} }; |
136 | 122 |
|
137 |
$form->{chart} = $chart; |
|
138 |
|
|
139 |
$form->{taxchart} = $tax; |
|
140 |
|
|
141 | 123 |
$form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2); |
142 | 124 |
|
143 | 125 |
# departments |
... | ... | |
1081 | 1063 |
|
1082 | 1064 |
$form->{totaldebit} = 0; |
1083 | 1065 |
$form->{totalcredit} = 0; |
1084 |
my $chart = $form->{chart}; |
|
1085 |
$chart = $form->unquote($chart); |
|
1086 |
$form->{taxchart} = $form->unquote($form->{taxchart}); |
|
1087 |
$taxchart = $form->{taxchart}; |
|
1088 | 1066 |
|
1089 | 1067 |
my @old_project_ids = (); |
1090 | 1068 |
map({ push(@old_project_ids, $form->{"project_id_$_"}) |
... | ... | |
1092 | 1070 |
|
1093 | 1071 |
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", |
1094 | 1072 |
"all" => 0, |
1095 |
"old_id" => \@old_project_ids }); |
|
1073 |
"old_id" => \@old_project_ids }, |
|
1074 |
"charts" => { "key" => "ALL_CHARTS", |
|
1075 |
"transdate" => $form->{transdate} }, |
|
1076 |
"taxcharts" => "ALL_TAXCHARTS"); |
|
1096 | 1077 |
|
1097 | 1078 |
my %project_labels = (); |
1098 | 1079 |
my @project_values = (""); |
... | ... | |
1101 | 1082 |
$project_labels{$item->{"id"}} = $item->{"projectnumber"}; |
1102 | 1083 |
} |
1103 | 1084 |
|
1085 |
my %chart_labels = (); |
|
1086 |
my @chart_values = (); |
|
1087 |
my $taxchart_init; |
|
1088 |
foreach my $item (@{ $form->{ALL_CHARTS} }) { |
|
1089 |
my $key = Q($item->{accno}) . "--" . Q($item->{tax_id}); |
|
1090 |
$taxchart_init = $item->{taxkey_id} unless (@chart_values); |
|
1091 |
push(@chart_values, $key); |
|
1092 |
$chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description}); |
|
1093 |
} |
|
1094 |
|
|
1095 |
my %taxchart_labels = (); |
|
1096 |
my @taxchart_values = (); |
|
1097 |
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { |
|
1098 |
my $key = Q($item->{id}) . "--" . Q($item->{rate}); |
|
1099 |
$taxchart_init = $key if ($taxchart_init eq $item->{taxkey}); |
|
1100 |
push(@taxchart_values, $key); |
|
1101 |
$taxchart_labels{$key} = H($item->{taxdescription}) . " " . |
|
1102 |
H($item->{rate} * 100) . ' %'; |
|
1103 |
} |
|
1104 |
|
|
1104 | 1105 |
for $i (1 .. $form->{rowcount}) { |
1105 | 1106 |
|
1106 | 1107 |
$source = qq| |
... | ... | |
1110 | 1111 |
<td><input name="memo_$i" value="$form->{"memo_$i"}" size="16" tabindex=| |
1111 | 1112 |
. ($i + 12 + (($i - 1) * 8)) . qq|></td>|; |
1112 | 1113 |
|
1113 |
if ($init) { |
|
1114 |
$accno = qq| |
|
1115 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=| |
|
1116 |
. ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|; |
|
1117 |
$tax = |
|
1118 |
qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=| |
|
1119 |
. ($i + 10 + (($i - 1) * 8)) |
|
1120 |
. qq|>$form->{taxchart}</select></td>|; |
|
1114 |
$accno = qq|<td>| . |
|
1115 |
$cgi->popup_menu('-name' => "accno_$i", |
|
1116 |
'-onChange' => "setTaxkey(this, $i)", |
|
1117 |
'-style' => 'width:200px', |
|
1118 |
'-tabindex' => ($i + 5 + (($i - 1) * 8)), |
|
1119 |
'-values' => \@chart_values, |
|
1120 |
'-labels' => \%chart_labels, |
|
1121 |
'-default' => $init ? '' : $form->{"accno_$i"}) |
|
1122 |
. qq|</td>|; |
|
1123 |
$tax = qq|<td>| . |
|
1124 |
$cgi->popup_menu('-name' => "taxchart_$i", |
|
1125 |
'-style' => 'width:200px', |
|
1126 |
'-tabindex' => ($i + 10 + (($i - 1) * 8)), |
|
1127 |
'-values' => \@taxchart_values, |
|
1128 |
'-labels' => \%taxchart_labels, |
|
1129 |
'-default' => $init ? $taxchart_init : $form->{"taxchart_$i"}) |
|
1130 |
. qq|</td>|; |
|
1121 | 1131 |
|
1132 |
if ($init) { |
|
1122 | 1133 |
$korrektur = |
1123 | 1134 |
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=| |
1124 | 1135 |
. ($i + 9 + (($i - 1) * 8)) |
... | ... | |
1150 | 1161 |
} |
1151 | 1162 |
|
1152 | 1163 |
if ($i < $form->{rowcount}) { |
1153 |
|
|
1154 |
$accno = $chart; |
|
1155 |
$chart_selected = $form->{"accno_$i"}; |
|
1156 |
$accno =~ |
|
1157 |
s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/; |
|
1158 |
$accno = |
|
1159 |
qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=| |
|
1160 |
. ($i + 5 + (($i - 1) * 8)) |
|
1161 |
. qq|>$accno</select></td>|; |
|
1162 |
$tax = $taxchart; |
|
1163 |
$tax_selected = $form->{"taxchart_$i"}; |
|
1164 |
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/; |
|
1165 |
$tax = |
|
1166 |
qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=| |
|
1167 |
. ($i + 10 + (($i - 1) * 8)) |
|
1168 |
. qq|>$tax</select></td>|; |
|
1169 |
|
|
1170 | 1164 |
if ($form->{transfer}) { |
1171 | 1165 |
$checked = ($form->{"fx_transaction_$i"}) ? "1" : ""; |
1172 | 1166 |
$x = ($checked) ? "x" : ""; |
... | ... | |
1182 | 1176 |
$form->hide_form("accno_$i"); |
1183 | 1177 |
|
1184 | 1178 |
} else { |
1185 |
|
|
1186 |
$accno = qq| |
|
1187 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=| |
|
1188 |
. ($i + 5 + (($i - 1) * 8)) . qq|>$chart</select></td>|; |
|
1189 |
$tax = qq| |
|
1190 |
<td><select id="taxchart_$i" name="taxchart_$i" tabindex=| |
|
1191 |
. ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|; |
|
1192 |
|
|
1193 | 1179 |
$korrektur = |
1194 | 1180 |
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=| |
1195 | 1181 |
. ($i + 9 + (($i - 1) * 8)) |
... | ... | |
1339 | 1325 |
<input type=hidden name=closedto value=$form->{closedto}> |
1340 | 1326 |
<input type=hidden name=locked value=$form->{locked}> |
1341 | 1327 |
<input type=hidden name=title value="$title"> |
1342 |
<input type=hidden name=taxchart value="$form->{taxchart}"> |
|
1343 |
<input type=hidden name=chart value="$form->{chart}"> |
|
1344 | 1328 |
|
1345 | 1329 |
|
1346 | 1330 |
<table width=100%> |
... | ... | |
1532 | 1516 |
<form method=post action=$form->{script}> |
1533 | 1517 |
|; |
1534 | 1518 |
|
1535 |
map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart);
|
|
1519 |
map { $form->{$_} =~ s/\"/"/g } qw(reference description); |
|
1536 | 1520 |
|
1537 | 1521 |
delete $form->{header}; |
1538 | 1522 |
|
Auch abrufbar als: Unified diff
Dialogbuchen: Die Drop-Down-Boxen bei jedem Formularaufbau aus der Datenbank heraus aufbauen und nicht in $form mitschleifen. Behebt auch den Fehler, dass das Steuerkonto beim initialen Aufbau nicht richtig ausgewählt wurde.