34 |
34 |
use SL::GL;
|
35 |
35 |
use SL::PE;
|
36 |
36 |
|
37 |
|
use Data::Dumper;
|
38 |
|
|
39 |
37 |
require "$form->{path}/arap.pl";
|
40 |
38 |
|
41 |
39 |
1;
|
... | ... | |
92 |
90 |
. ($_->{rate} * 100) . qq| %|
|
93 |
91 |
} @{ $form->{TAX} };
|
94 |
92 |
|
95 |
|
$form->{chart} = $chart;
|
|
93 |
$form->{chart} = $chart;
|
|
94 |
$form->{chartinit} = $chart;
|
|
95 |
$form->{rowcount} = 2;
|
96 |
96 |
|
97 |
97 |
$form->{debitchart} = $chart;
|
98 |
98 |
$form->{creditchart} = $chart;
|
... | ... | |
102 |
102 |
$form->{credit} = 0;
|
103 |
103 |
$form->{tax} = 0;
|
104 |
104 |
|
105 |
|
$form->{creditrowcount} = 2;
|
106 |
|
$form->{debitrowcount} = 2;
|
107 |
|
|
108 |
105 |
# departments
|
109 |
106 |
$form->all_departments(\%myconfig);
|
110 |
107 |
if (@{ $form->{all_departments} }) {
|
... | ... | |
116 |
113 |
} (@{ $form->{all_departments} });
|
117 |
114 |
}
|
118 |
115 |
|
119 |
|
&display_form;
|
120 |
|
|
|
116 |
&display_form(1);
|
121 |
117 |
$lxdebug->leave_sub();
|
|
118 |
|
122 |
119 |
}
|
123 |
120 |
|
124 |
121 |
sub edit {
|
125 |
122 |
$lxdebug->enter_sub();
|
126 |
123 |
|
127 |
124 |
GL->transaction(\%myconfig, \%$form);
|
128 |
|
|
129 |
|
map {
|
130 |
|
if ($form->{debitaccno} eq $_->{accno}) {
|
131 |
|
$form->{debitchart} .=
|
132 |
|
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}";
|
133 |
|
}
|
134 |
|
} @{ $form->{chart} };
|
135 |
|
map {
|
136 |
|
if ($form->{creditaccno} eq $_->{accno}) {
|
137 |
|
$form->{creditchart} .=
|
138 |
|
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}";
|
139 |
|
}
|
140 |
|
} @{ $form->{chart} };
|
141 |
|
map {
|
142 |
|
$tax .=
|
143 |
|
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
|
144 |
|
. ($_->{rate} * 100) . qq| %|
|
145 |
|
} @{ $form->{TAX} };
|
146 |
|
|
147 |
|
if ($form->{creditrowcount} > 2) {
|
148 |
|
for $i (2 .. $form->{creditrowcount}) {
|
149 |
|
map {
|
150 |
|
if ($form->{"creditchartselected_$i"} eq $_->{accno}) {
|
151 |
|
$form->{"creditchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}";
|
152 |
|
}
|
153 |
|
} @{ $form->{chart} };
|
154 |
|
map {
|
155 |
|
if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {
|
156 |
|
$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}";
|
157 |
|
}
|
158 |
|
} @{ $form->{TAX} };
|
159 |
|
}
|
160 |
|
}
|
161 |
|
if ($form->{debitrowcount} > 2) {
|
162 |
|
for $i (2 .. $form->{debitrowcount}) {
|
163 |
|
map {
|
164 |
|
if ($form->{"debitchartselected_$i"} eq $_->{accno}) {
|
165 |
|
$form->{"debitchartselected_$i"} = "$_->{accno}--$_->{taxkey_id}";
|
166 |
|
}
|
167 |
|
} @{ $form->{chart} };
|
168 |
|
map {
|
169 |
|
if ($form->{"taxchartselected_$i"} eq $_->{taxkey}) {
|
170 |
|
$form->{"taxchartselected_$i"} = "$_->{taxkey}--$_->{rate}";
|
171 |
|
}
|
172 |
|
} @{ $form->{TAX} };
|
173 |
|
}
|
174 |
|
}
|
175 |
125 |
map {
|
176 |
126 |
$chart .=
|
177 |
127 |
"<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
|
178 |
128 |
} @{ $form->{chart} };
|
179 |
|
$form->{chart} = $chart;
|
|
129 |
|
180 |
130 |
map {
|
181 |
131 |
$tax .=
|
182 |
132 |
qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
|
183 |
133 |
. ($_->{rate} * 100) . qq| %|
|
184 |
134 |
} @{ $form->{TAX} };
|
185 |
|
$form->{taxchart} = $tax;
|
186 |
135 |
|
187 |
|
if ($form->{tax} < 0) {
|
188 |
|
$form->{tax} = $form->{tax} * (-1);
|
189 |
|
}
|
|
136 |
$form->{chart} = $chart;
|
|
137 |
|
|
138 |
$form->{taxchart} = $tax;
|
190 |
139 |
|
191 |
140 |
$form->{amount} = $form->format_amount(\%myconfig, $form->{amount}, 2);
|
192 |
141 |
|
... | ... | |
201 |
150 |
} (@{ $form->{all_departments} });
|
202 |
151 |
}
|
203 |
152 |
|
204 |
|
$form->{locked} =
|
|
153 |
my $i = 1;
|
|
154 |
my $tax = 0;
|
|
155 |
my $taxaccno = "";
|
|
156 |
foreach $ref (@{ $form->{GL} }) {
|
|
157 |
$form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}";
|
|
158 |
|
|
159 |
$j = $i - 1;
|
|
160 |
if ($tax && ($ref->{accno} eq $taxaccno)) {
|
|
161 |
$form->{"tax_$j"} = abs($ref->{amount});
|
|
162 |
$form->{"taxchart_$j"} = $ref->{taxkey} . "--" . $ref->{taxrate};
|
|
163 |
} else {
|
|
164 |
$form->{"accno_$i"} = "$ref->{accno}--$ref->{accnotaxkey}";
|
|
165 |
for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
|
|
166 |
if ($ref->{amount} < 0) {
|
|
167 |
$form->{totaldebit} -= $ref->{amount};
|
|
168 |
$form->{"debit_$i"} = $ref->{amount} * -1;
|
|
169 |
} else {
|
|
170 |
$form->{totalcredit} += $ref->{amount};
|
|
171 |
$form->{"credit_$i"} = $ref->{amount};
|
|
172 |
}
|
|
173 |
$i++;
|
|
174 |
}
|
|
175 |
if ($ref->{taxaccno} && !$tax) {
|
|
176 |
$taxaccno = $ref->{taxaccno};
|
|
177 |
$tax = 1;
|
|
178 |
} else {
|
|
179 |
$taxaccno = "";
|
|
180 |
$tax = 0;
|
|
181 |
}
|
|
182 |
|
|
183 |
}
|
|
184 |
|
|
185 |
$form->{rowcount} = $i;
|
|
186 |
$form->{locked} =
|
205 |
187 |
($form->datetonum($form->{transdate}, \%myconfig) <=
|
206 |
188 |
$form->datetonum($form->{closedto}, \%myconfig));
|
207 |
189 |
|
208 |
190 |
$form->{title} = "Edit";
|
209 |
191 |
|
210 |
192 |
&form_header;
|
211 |
|
|
|
193 |
&display_rows;
|
212 |
194 |
&form_footer;
|
213 |
|
|
214 |
195 |
$lxdebug->leave_sub();
|
|
196 |
|
215 |
197 |
}
|
216 |
198 |
|
217 |
199 |
sub search {
|
... | ... | |
247 |
229 |
$button1 = qq|
|
248 |
230 |
<td><input name=datefrom id=datefrom size=11 title="$myconfig{dateformat}">
|
249 |
231 |
<input type=button name=datefrom id="trigger1" value=|
|
250 |
|
. $locale->text('button')
|
251 |
|
. qq|></td>
|
|
232 |
. $locale->text('button') . qq|></td>
|
252 |
233 |
|;
|
253 |
234 |
$button2 = qq|
|
254 |
235 |
<td><input name=dateto id=dateto size=11 title="$myconfig{dateformat}">
|
255 |
236 |
<input type=button name=dateto id="trigger2" value=|
|
256 |
|
. $locale->text('button')
|
257 |
|
. qq|></td>
|
|
237 |
. $locale->text('button') . qq|></td>
|
258 |
238 |
|;
|
259 |
239 |
|
260 |
240 |
#write Trigger
|
... | ... | |
317 |
297 |
. $locale->text('All') . qq|
|
318 |
298 |
<input name="category" class=radio type=radio value=A> |
|
319 |
299 |
. $locale->text('Asset') . qq|
|
320 |
|
<input name="category" class=radio type=radio value=L> |
|
|
300 |
<input name="category" class=radio type=radio value=C> |
|
|
301 |
. $locale->text('Contra') . qq|
|
|
302 |
<input name="category" class=radio type=radio value=L> |
|
321 |
303 |
. $locale->text('Liability') . qq|
|
|
304 |
<input name="category" class=radio type=radio value=Q> |
|
|
305 |
. $locale->text('Equity') . qq|
|
322 |
306 |
<input name="category" class=radio type=radio value=I> |
|
323 |
307 |
. $locale->text('Revenue') . qq|
|
324 |
308 |
<input name="category" class=radio type=radio value=E> |
|
... | ... | |
481 |
465 |
. $locale->date(\%myconfig, $form->{dateto}, 1);
|
482 |
466 |
}
|
483 |
467 |
|
484 |
|
@columns =
|
485 |
|
$form->sort_columns(
|
|
468 |
@columns = $form->sort_columns(
|
486 |
469 |
qw(transdate id reference description notes source debit debit_accno credit credit_accno debit_tax debit_tax_accno credit_tax credit_tax_accno accno gifi_accno)
|
487 |
|
);
|
|
470 |
);
|
488 |
471 |
|
489 |
472 |
if ($form->{accno} || $form->{gifi_accno}) {
|
490 |
473 |
@columns = grep !/(accno|gifi_accno)/, @columns;
|
... | ... | |
868 |
851 |
</body>
|
869 |
852 |
</html>
|
870 |
853 |
|;
|
871 |
|
|
872 |
854 |
$lxdebug->leave_sub();
|
|
855 |
|
873 |
856 |
}
|
874 |
857 |
|
875 |
858 |
sub gl_subtotal {
|
... | ... | |
893 |
876 |
$subtotalcredit = 0;
|
894 |
877 |
|
895 |
878 |
$sameitem = $ref->{ $form->{sort} };
|
896 |
|
|
897 |
879 |
$lxdebug->leave_sub();
|
898 |
880 |
|
899 |
|
return $sameitem;
|
900 |
881 |
}
|
901 |
882 |
|
902 |
883 |
sub update {
|
903 |
884 |
$lxdebug->enter_sub();
|
904 |
885 |
|
905 |
|
@a = ();
|
906 |
|
$count = 0;
|
907 |
|
@flds = (qw(accno debit credit projectnumber project_id oldprojectnumber));
|
908 |
|
$credit_save = $form->{credit};
|
909 |
|
$debit_save = $form->{debit};
|
910 |
|
|
911 |
|
if ($form->{chart} eq "") {
|
912 |
|
$form->{creditchart} =
|
913 |
|
"<option>" . $form->{creditchartselected} . "</option>";
|
914 |
|
$form->{debitchart} =
|
915 |
|
"<option>" . $form->{debitchartselected} . "</option>";
|
916 |
|
} else {
|
917 |
|
$form->{creditchart} = $form->{chart};
|
918 |
|
$form->{creditchart} =~
|
919 |
|
s/value=\"$form->{creditchartselected}\"/value=\"$form->{creditchartselected}\" selected/;
|
920 |
|
|
921 |
|
$form->{debitchart} = $form->{chart};
|
922 |
|
$form->{debitchart} =~
|
923 |
|
s/value=\"$form->{debitchartselected}\"/value=\"$form->{debitchartselected}\" selected/;
|
|
886 |
if ($form->{transdate} ne $form->{oldtransdate}) {
|
|
887 |
if ($form->{selectprojectnumber}) {
|
|
888 |
$form->all_projects(\%myconfig, undef, $form->{transdate});
|
|
889 |
if (@{ $form->{all_project} }) {
|
|
890 |
$form->{selectprojectnumber} = "<option>\n";
|
|
891 |
for (@{ $form->{all_project} }) {
|
|
892 |
$form->{selectprojectnumber} .=
|
|
893 |
qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
|
|
894 |
}
|
|
895 |
$form->{selectprojectnumber} =
|
|
896 |
$form->escape($form->{selectprojectnumber}, 1);
|
|
897 |
}
|
|
898 |
}
|
|
899 |
$form->{oldtransdate} = $form->{transdate};
|
924 |
900 |
}
|
925 |
|
($debitaccno, $debittaxkey) = split(/--/, $form->{debitchartselected});
|
926 |
|
($creditaccno, $credittaxkey) = split(/--/, $form->{creditchartselected});
|
927 |
|
if ($debittaxkey > 0) {
|
928 |
|
$form->{taxchart} = $form->unescape($form->{taxchart});
|
929 |
|
$form->{taxchart} =~ s/selected//ig;
|
930 |
|
$form->{taxchart} =~
|
931 |
|
s/\"$debittaxkey--([^\"]*)\"/\"$debittaxkey--$1\" selected/;
|
932 |
901 |
|
933 |
|
$rate = $1;
|
|
902 |
my @a = ();
|
|
903 |
my $count = 0;
|
|
904 |
my $debittax = 0;
|
|
905 |
my $credittax = 0;
|
|
906 |
my $debitcount = 0;
|
|
907 |
my $creditcount = 0;
|
|
908 |
$debitlock = 0;
|
|
909 |
$creditlock = 0;
|
934 |
910 |
|
935 |
|
if ($form->{taxincluded}) {
|
936 |
|
$form->{debit} =
|
937 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
|
938 |
|
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
939 |
|
$form->{tax} =
|
940 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate;
|
941 |
|
} else {
|
942 |
|
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
943 |
|
$form->{credit} =
|
944 |
|
$form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
|
945 |
|
$form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
|
946 |
|
}
|
947 |
|
} else {
|
948 |
|
$form->{taxchart} = $form->unescape($form->{taxchart});
|
949 |
|
$form->{taxchart} =~ s/selected//ig;
|
950 |
|
$form->{taxchart} =~
|
951 |
|
s/\"$credittaxkey--([^\"]*)\"/\"$credittaxkey--$1\" selected/;
|
952 |
|
$rate = $1;
|
|
911 |
my @flds =
|
|
912 |
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
|
953 |
913 |
|
954 |
|
if ($form->{taxincluded}) {
|
955 |
|
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
956 |
|
$form->{credit} =
|
957 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
|
958 |
|
$form->{tax} =
|
959 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) * $rate;
|
960 |
|
} else {
|
961 |
|
$form->{debit} =
|
962 |
|
$form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
|
963 |
|
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
964 |
|
$form->{tax} = $form->parse_amount(\%myconfig, $form->{amount}) * $rate;
|
|
914 |
for my $i (1 .. $form->{rowcount}) {
|
|
915 |
|
|
916 |
unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
|
|
917 |
for (qw(debit credit tax)) {
|
|
918 |
$form->{"${_}_$i"} =
|
|
919 |
$form->parse_amount(\%myconfig, $form->{"${_}_$i"});
|
|
920 |
}
|
|
921 |
|
|
922 |
push @a, {};
|
|
923 |
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
|
|
924 |
if ($debitcredit) {
|
|
925 |
$debitcount++;
|
|
926 |
} else {
|
|
927 |
$creditcount++;
|
|
928 |
}
|
|
929 |
|
|
930 |
if (($debitcount >= 2) && ($creditcount == 2)) {
|
|
931 |
$form->{"credit_$i"} = 0;
|
|
932 |
$form->{"tax_$i"} = 0;
|
|
933 |
$creditcount--;
|
|
934 |
$creditlock = 1;
|
|
935 |
}
|
|
936 |
if (($creditcount >= 2) && ($debitcount == 2)) {
|
|
937 |
$form->{"debit_$i"} = 0;
|
|
938 |
$form->{"tax_$i"} = 0;
|
|
939 |
$debitcount--;
|
|
940 |
$debitlock = 1;
|
|
941 |
}
|
|
942 |
if (($creditcount == 1) && ($debitcount == 2)) {
|
|
943 |
$creditlock = 1;
|
|
944 |
}
|
|
945 |
if (($creditcount == 2) && ($debitcount == 1)) {
|
|
946 |
$debitlock = 1;
|
|
947 |
}
|
|
948 |
if ($debitcredit && $credittax) {
|
|
949 |
$form->{"taxchart_$i"} = "0--0.00";
|
|
950 |
}
|
|
951 |
if (!$debitcredit && $debittax) {
|
|
952 |
$form->{"taxchart_$i"} = "0--0.00";
|
|
953 |
}
|
|
954 |
$amount =
|
|
955 |
($form->{"debit_$i"} == 0)
|
|
956 |
? $form->{"credit_$i"}
|
|
957 |
: $form->{"debit_$i"};
|
|
958 |
$j = $#a;
|
|
959 |
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
|
|
960 |
$form->{"taxchart_$i"} = "0--";
|
|
961 |
$form->{"tax_$i"} = 0;
|
|
962 |
}
|
|
963 |
if (!$form->{"korrektur_$i"}) {
|
|
964 |
($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
|
|
965 |
if ($taxkey > 1) {
|
|
966 |
if ($debitcredit) {
|
|
967 |
$debittax = 1;
|
|
968 |
} else {
|
|
969 |
$credittax = 1;
|
|
970 |
}
|
|
971 |
if ($form->{taxincluded}) {
|
|
972 |
$form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
|
|
973 |
} else {
|
|
974 |
$form->{"tax_$i"} = $amount * $rate;
|
|
975 |
}
|
|
976 |
} else {
|
|
977 |
$form->{"tax_$i"} = 0;
|
|
978 |
}
|
|
979 |
}
|
|
980 |
|
|
981 |
for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
|
|
982 |
$count++;
|
965 |
983 |
}
|
966 |
984 |
}
|
967 |
|
if ($form->{credit_splited}) {
|
968 |
|
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
969 |
|
$form->{credit} = $credit_save;
|
970 |
|
$form->{tax} = 0;
|
971 |
|
} elsif ($form->{debit_splited}) {
|
972 |
|
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
973 |
|
$form->{debit} = $debit_save;
|
974 |
|
$form->{tax} = 0;
|
|
985 |
|
|
986 |
for $i (1 .. $count) {
|
|
987 |
$j = $i - 1;
|
|
988 |
for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }
|
975 |
989 |
}
|
976 |
|
&check_project;
|
977 |
990 |
|
978 |
|
&display_form;
|
|
991 |
for $i ($count + 1 .. $form->{rowcount}) {
|
|
992 |
for (@flds) { delete $form->{"${_}_$i"} }
|
|
993 |
}
|
|
994 |
|
|
995 |
$form->{rowcount} = $count + 1;
|
979 |
996 |
|
|
997 |
&display_form;
|
980 |
998 |
$lxdebug->leave_sub();
|
|
999 |
|
981 |
1000 |
}
|
982 |
1001 |
|
983 |
1002 |
sub display_form {
|
|
1003 |
my ($init) = @_;
|
984 |
1004 |
$lxdebug->enter_sub();
|
985 |
1005 |
|
986 |
|
&form_header;
|
|
1006 |
&form_header($init);
|
987 |
1007 |
|
988 |
1008 |
# for $i (1 .. $form->{rowcount}) {
|
989 |
1009 |
# $form->{totaldebit} += $form->parse_amount(\%myconfig, $form->{"debit_$i"});
|
... | ... | |
991 |
1011 |
#
|
992 |
1012 |
# &form_row($i);
|
993 |
1013 |
# }
|
994 |
|
|
|
1014 |
&display_rows($init);
|
995 |
1015 |
&form_footer;
|
|
1016 |
$lxdebug->leave_sub();
|
996 |
1017 |
|
|
1018 |
}
|
|
1019 |
|
|
1020 |
sub display_rows {
|
|
1021 |
my ($init) = @_;
|
|
1022 |
$lxdebug->enter_sub();
|
|
1023 |
|
|
1024 |
$form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber})
|
|
1025 |
if $form->{selectprojectnumber};
|
|
1026 |
|
|
1027 |
$form->{totaldebit} = 0;
|
|
1028 |
$form->{totalcredit} = 0;
|
|
1029 |
my $chart = $form->{chart};
|
|
1030 |
$chart = $form->unquote($chart);
|
|
1031 |
$form->{taxchart} = $form->unquote($form->{taxchart});
|
|
1032 |
$taxchart = $form->{taxchart};
|
|
1033 |
for $i (1 .. $form->{rowcount}) {
|
|
1034 |
|
|
1035 |
$source = qq|
|
|
1036 |
<td><input name="source_$i" value="$form->{"source_$i"}" tabindex=|
|
|
1037 |
. ($i + 11 + (($i - 1) * 8)) . qq|></td>|;
|
|
1038 |
$memo = qq|
|
|
1039 |
<td><input name="memo_$i" value="$form->{"memo_$i"}" tabindex=|
|
|
1040 |
. ($i + 12 + (($i - 1) * 8)) . qq|></td>|;
|
|
1041 |
|
|
1042 |
if ($init) {
|
|
1043 |
$accno = qq|
|
|
1044 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
|
|
1045 |
. ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|;
|
|
1046 |
$tax =
|
|
1047 |
qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
|
|
1048 |
. ($i + 10 + (($i - 1) * 8))
|
|
1049 |
. qq|>$form->{taxchart}</select></td>|;
|
|
1050 |
if ($form->{selectprojectnumber}) {
|
|
1051 |
$project = qq|
|
|
1052 |
<td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
|
|
1053 |
}
|
|
1054 |
$korrektur =
|
|
1055 |
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
|
|
1056 |
. ($i + 9 + (($i - 1) * 8))
|
|
1057 |
. qq|></td>|;
|
|
1058 |
if ($form->{transfer}) {
|
|
1059 |
$fx_transaction = qq|
|
|
1060 |
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
|
|
1061 |
|;
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
} else {
|
|
1065 |
if ($form->{"debit_$i"} != 0) {
|
|
1066 |
$form->{totaldebit} += $form->{"debit_$i"};
|
|
1067 |
$form->{totaldebit} += $form->{"tax_$i"};
|
|
1068 |
} else {
|
|
1069 |
$form->{totalcredit} += $form->{"credit_$i"};
|
|
1070 |
$form->{totalcredit} += $form->{"tax_$i"};
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
for (qw(debit credit tax)) {
|
|
1074 |
$form->{"${_}_$i"} =
|
|
1075 |
($form->{"${_}_$i"})
|
|
1076 |
? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
|
|
1077 |
: "";
|
|
1078 |
}
|
|
1079 |
|
|
1080 |
if ($i < $form->{rowcount}) {
|
|
1081 |
|
|
1082 |
$accno = $chart;
|
|
1083 |
$chart_selected = $form->{"accno_$i"};
|
|
1084 |
$accno =~
|
|
1085 |
s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/;
|
|
1086 |
$accno =
|
|
1087 |
qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
|
|
1088 |
. ($i + 5 + (($i - 1) * 8))
|
|
1089 |
. qq|>$accno</select></td>|;
|
|
1090 |
$tax = $taxchart;
|
|
1091 |
$tax_selected = $form->{"taxchart_$i"};
|
|
1092 |
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
|
|
1093 |
$tax =
|
|
1094 |
qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
|
|
1095 |
. ($i + 10 + (($i - 1) * 8))
|
|
1096 |
. qq|>$tax</select></td>|;
|
|
1097 |
|
|
1098 |
if ($form->{selectprojectnumber}) {
|
|
1099 |
$form->{"projectnumber_$i"} = ""
|
|
1100 |
if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
|
|
1101 |
|
|
1102 |
$project = $form->{"projectnumber_$i"};
|
|
1103 |
$project =~ s/--.*//;
|
|
1104 |
$project = qq|<td>$project</td>|;
|
|
1105 |
}
|
|
1106 |
|
|
1107 |
if ($form->{transfer}) {
|
|
1108 |
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
|
|
1109 |
$x = ($checked) ? "x" : "";
|
|
1110 |
$fx_transaction = qq|
|
|
1111 |
<td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td>
|
|
1112 |
|;
|
|
1113 |
}
|
|
1114 |
$checked = ($form->{"korrektur_$i"}) ? "checked" : "";
|
|
1115 |
$korrektur =
|
|
1116 |
qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked tabindex=|
|
|
1117 |
. ($i + 9 + (($i - 1) * 8))
|
|
1118 |
. qq|></td>|;
|
|
1119 |
$form->hide_form("accno_$i", "projectnumber_$i");
|
|
1120 |
|
|
1121 |
} else {
|
|
1122 |
|
|
1123 |
$accno = qq|
|
|
1124 |
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
|
|
1125 |
. ($i + 5 + (($i - 1) * 8)) . qq|>$chart</select></td>|;
|
|
1126 |
$tax = qq|
|
|
1127 |
<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
|
|
1128 |
. ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
|
|
1129 |
if ($form->{selectprojectnumber}) {
|
|
1130 |
$project = qq|
|
|
1131 |
<td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
|
|
1132 |
}
|
|
1133 |
$korrektur =
|
|
1134 |
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
|
|
1135 |
. ($i + 9 + (($i - 1) * 8))
|
|
1136 |
. qq|></td>|;
|
|
1137 |
if ($form->{transfer}) {
|
|
1138 |
$fx_transaction = qq|
|
|
1139 |
<td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
|
|
1140 |
|;
|
|
1141 |
}
|
|
1142 |
}
|
|
1143 |
}
|
|
1144 |
my $debitreadonly = "";
|
|
1145 |
my $creditreadonly = "";
|
|
1146 |
if ($i == $form->{rowcount}) {
|
|
1147 |
if ($debitlock) {
|
|
1148 |
$debitreadonly = "readonly";
|
|
1149 |
} elsif ($creditlock) {
|
|
1150 |
$creditreadonly = "readonly";
|
|
1151 |
}
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
print qq|<tr valign=top>
|
|
1155 |
$accno
|
|
1156 |
$fx_transaction
|
|
1157 |
<td><input name="debit_$i" size=10 value="$form->{"debit_$i"}" accesskey=$i tabindex=|
|
|
1158 |
. ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly></td>
|
|
1159 |
<td><input name="credit_$i" size=10 value="$form->{"credit_$i"}" tabindex=|
|
|
1160 |
. ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly></td>
|
|
1161 |
<td><input name="tax_$i" size=8 value="$form->{"tax_$i"}" tabindex=|
|
|
1162 |
. ($i + 8 + (($i - 1) * 8)) . qq|></td>
|
|
1163 |
$korrektur
|
|
1164 |
$tax
|
|
1165 |
$source
|
|
1166 |
$memo
|
|
1167 |
$project
|
|
1168 |
</tr>
|
|
1169 |
|
|
1170 |
|;
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
$form->hide_form(qw(rowcount selectaccno));
|
|
1174 |
print qq|
|
|
1175 |
<input type=hidden name=selectprojectnumber value="|
|
|
1176 |
. $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
|
997 |
1177 |
$lxdebug->leave_sub();
|
|
1178 |
|
998 |
1179 |
}
|
999 |
1180 |
|
1000 |
1181 |
sub form_header {
|
|
1182 |
my ($init) = @_;
|
1001 |
1183 |
$lxdebug->enter_sub();
|
1002 |
|
|
1003 |
1184 |
$title = $form->{title};
|
1004 |
1185 |
$form->{title} = $locale->text("$title General Ledger Transaction");
|
1005 |
1186 |
$readonly = ($form->{id}) ? "readonly" : "";
|
1006 |
1187 |
|
1007 |
|
$form->{urldebit} =
|
1008 |
|
"$form->{script}?action=split_debit&path=$form->{path}&login=$form->{login}&password=$form->{password}";
|
1009 |
|
$form->{urlcredit} =
|
1010 |
|
"$form->{script}?action=split_credit&path=$form->{path}&login=$form->{login}&password=$form->{password}";
|
1011 |
|
|
1012 |
1188 |
# $locale->text('Add General Ledger Transaction')
|
1013 |
1189 |
# $locale->text('Edit General Ledger Transaction')
|
1014 |
|
map { $form->{$_} =~ s/\"/"/g } qw(reference description chart);
|
|
1190 |
|
|
1191 |
map { $form->{$_} =~ s/\"/"/g }
|
|
1192 |
qw(reference description chart taxchart);
|
|
1193 |
$form->{javascript} = qq|<script type="text/javascript">
|
|
1194 |
<!--
|
|
1195 |
function setTaxkey(accno, row) {
|
|
1196 |
var taxkey = accno.options[accno.selectedIndex].value;
|
|
1197 |
var reg = /--([0-9])*/;
|
|
1198 |
var found = reg.exec(taxkey);
|
|
1199 |
var index = found[1];
|
|
1200 |
index = parseInt(index);
|
|
1201 |
var tax = 'taxchart_' + row;
|
|
1202 |
for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
|
|
1203 |
var reg2 = new RegExp("^"+ index, "");
|
|
1204 |
if (reg2.exec(document.getElementById(tax).options[i].value)) {
|
|
1205 |
document.getElementById(tax).options[i].selected = true;
|
|
1206 |
break;
|
|
1207 |
}
|
|
1208 |
}
|
|
1209 |
};
|
|
1210 |
//-->
|
|
1211 |
</script>|;
|
1015 |
1212 |
|
1016 |
1213 |
$form->{selectdepartment} =~ s/ selected//;
|
1017 |
|
$form->{taxchart} =~ s/ selected//;
|
1018 |
1214 |
$form->{selectdepartment} =~
|
1019 |
1215 |
s/option>\Q$form->{department}\E/option selected>$form->{department}/;
|
1020 |
1216 |
|
... | ... | |
1028 |
1224 |
|
1029 |
1225 |
$taxincluded = ($form->{taxincluded}) ? "checked" : "";
|
1030 |
1226 |
|
1031 |
|
if (!$form->{id}) {
|
|
1227 |
if ($init) {
|
1032 |
1228 |
$taxincluded = "checked";
|
1033 |
1229 |
}
|
1034 |
1230 |
|
1035 |
|
$amount =
|
1036 |
|
qq|<input name=amount size=20 value="$form->{amount}" tabindex="4" $readonly>|;
|
1037 |
|
|
1038 |
1231 |
$department = qq|
|
1039 |
1232 |
<tr>
|
1040 |
1233 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
|
... | ... | |
1042 |
1235 |
<input type=hidden name=selectdepartment value="$form->{selectdepartment}">
|
1043 |
1236 |
</tr>
|
1044 |
1237 |
| if $form->{selectdepartment};
|
1045 |
|
|
1046 |
|
$form->{fokus} = "gl.reference";
|
1047 |
|
$form->{remote} = 1;
|
|
1238 |
if ($init) {
|
|
1239 |
$form->{fokus} = "gl.reference";
|
|
1240 |
} else {
|
|
1241 |
$form->{fokus} = qq|gl.accno_$form->{rowcount}|;
|
|
1242 |
}
|
1048 |
1243 |
|
1049 |
1244 |
# use JavaScript Calendar or not
|
1050 |
1245 |
$form->{jsscript} = $jscalendar;
|
... | ... | |
1053 |
1248 |
|
1054 |
1249 |
# with JavaScript Calendar
|
1055 |
1250 |
$button1 = qq|
|
1056 |
|
<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly></td>
|
1057 |
|
<td><input type=button name=transdate id="trigger1" value=|
|
1058 |
|
. $locale->text('button')
|
1059 |
|
. qq|></td>
|
|
1251 |
<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate} tabindex="2" $readonly>
|
|
1252 |
<input type=button name=transdate id="trigger1" value=|
|
|
1253 |
. $locale->text('button') . qq|></td>
|
1060 |
1254 |
|;
|
1061 |
1255 |
|
1062 |
1256 |
#write Trigger
|
... | ... | |
1082 |
1276 |
<input type=hidden name=closedto value=$form->{closedto}>
|
1083 |
1277 |
<input type=hidden name=locked value=$form->{locked}>
|
1084 |
1278 |
<input type=hidden name=title value="$title">
|
1085 |
|
<input type=hidden name=taxchart value=|
|
1086 |
|
. $form->escape($form->{taxchart}) . qq|>
|
|
1279 |
<input type=hidden name=taxchart value="$form->{taxchart}">
|
1087 |
1280 |
<input type=hidden name=chart value="$form->{chart}">
|
1088 |
|
<input type=hidden name=creditrowcount value="$form->{creditrowcount}">
|
1089 |
|
<input type=hidden name=debitrowcount value="$form->{debitrowcount}">
|
1090 |
1281 |
|
1091 |
1282 |
|
1092 |
1283 |
<table width=100%>
|
... | ... | |
1098 |
1289 |
<td>
|
1099 |
1290 |
<table width=100%>
|
1100 |
1291 |
<tr>
|
1101 |
|
<th align=right>| . $locale->text('Reference') . qq|</th>
|
|
1292 |
<th align=left>| . $locale->text('Reference') . qq|</th>
|
1102 |
1293 |
<td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
|
1103 |
1294 |
<td align=left>
|
1104 |
|
<table width=100%>
|
|
1295 |
<table>
|
1105 |
1296 |
<tr>
|
1106 |
1297 |
<th align=right nowrap>| . $locale->text('Date') . qq|</th>
|
1107 |
1298 |
$button1
|
... | ... | |
1115 |
1306 |
<th align=right>| . $locale->text('Belegnummer') . qq|</th>
|
1116 |
1307 |
<td><input name=id size=20 value="$form->{id}" $readonly></td>
|
1117 |
1308 |
<td align=left>
|
1118 |
|
<table width=100%>
|
|
1309 |
<table>
|
1119 |
1310 |
<tr>
|
1120 |
1311 |
<th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
|
1121 |
1312 |
<td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly></td>
|
... | ... | |
1124 |
1315 |
</td>
|
1125 |
1316 |
</tr>|;
|
1126 |
1317 |
}
|
1127 |
|
print qq|
|
|
1318 |
print qq|
|
1128 |
1319 |
$department|;
|
1129 |
1320 |
if ($form->{id}) {
|
1130 |
1321 |
print qq|
|
1131 |
1322 |
<tr>
|
1132 |
|
<th align=right>| . $locale->text('Description') . qq|</th>
|
1133 |
|
<td>$description</td>
|
|
1323 |
<th align=left width=1%>| . $locale->text('Description') . qq|</th>
|
|
1324 |
<td width=1%>$description</td>
|
|
1325 |
<td>
|
|
1326 |
<table>
|
|
1327 |
<tr>
|
|
1328 |
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
|
|
1329 |
<td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
|
|
1330 |
</tr>
|
|
1331 |
</table>
|
|
1332 |
</td>
|
1134 |
1333 |
<td align=left>
|
1135 |
1334 |
<table width=100%>
|
1136 |
1335 |
<tr>
|
... | ... | |
1143 |
1342 |
} else {
|
1144 |
1343 |
print qq|
|
1145 |
1344 |
<tr>
|
1146 |
|
<th align=right>| . $locale->text('Description') . qq|</th>
|
1147 |
|
<td colspan=3>$description</td>
|
1148 |
|
</tr>|;
|
1149 |
|
}
|
1150 |
|
print qq|
|
1151 |
|
<tr>
|
1152 |
|
<th align=right>| . $locale->text('Betrag') . qq|</th>
|
1153 |
|
<td>$amount</td>
|
1154 |
|
<td align=left colspan=2>
|
|
1345 |
<th align=left width=1%>| . $locale->text('Description') . qq|</th>
|
|
1346 |
<td width=1%>$description</td>
|
|
1347 |
<td>
|
1155 |
1348 |
<table>
|
1156 |
1349 |
<tr>
|
1157 |
1350 |
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
|
1158 |
|
<td><input type=checkbox name=taxincluded value=1 tabindex="8" $taxincluded></td>
|
|
1351 |
<td><input type=checkbox name=taxincluded value=1 tabindex="5" $taxincluded></td>
|
1159 |
1352 |
</tr>
|
1160 |
1353 |
</table>
|
1161 |
1354 |
</td>
|
1162 |
1355 |
</tr>|;
|
1163 |
|
if ($form->{debit_splited}) {
|
1164 |
|
print qq|
|
1165 |
|
<tr>
|
1166 |
|
<th align=right>| . $locale->text('Debit') . qq|</th>
|
1167 |
|
<td>Betrag gesplittet</td>
|
1168 |
|
<td><input name=debit size=10 value="|
|
1169 |
|
. $form->format_amount(\%myconfig, $form->{debit}, 2)
|
1170 |
|
. qq|" readonly> EUR</td>
|
1171 |
|
<td><input class=submit type=submit name=action value="|
|
1172 |
|
. $locale->text('Split Debit')
|
1173 |
|
. qq|"></td>
|
1174 |
|
<input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
|
1175 |
|
</tr>
|
1176 |
|
<tr>
|
1177 |
|
<th align=right>| . $locale->text('Credit') . qq|</th>
|
1178 |
|
<td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
|
1179 |
|
<td><input name=credit size=10 value="|
|
1180 |
|
. $form->format_amount(\%myconfig, $form->{credit}, 2)
|
1181 |
|
. qq|" readonly > EUR</td>
|
1182 |
|
<input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
|
1183 |
|
</tr>
|
1184 |
|
|;
|
1185 |
|
} elsif ($form->{credit_splited}) {
|
1186 |
|
print qq|
|
1187 |
|
<tr>
|
1188 |
|
<th align=right>| . $locale->text('Debit') . qq|</th>
|
1189 |
|
<td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
|
1190 |
|
<td><input name=debit size=10 value="|
|
1191 |
|
. $form->format_amount(\%myconfig, $form->{debit}, 2)
|
1192 |
|
. qq|" readonly> EUR</td>
|
1193 |
|
<input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
|
1194 |
|
</tr>
|
1195 |
|
<tr>
|
1196 |
|
<th align=right>| . $locale->text('Credit') . qq|</th>
|
1197 |
|
<td>Betrag gesplittet</td>
|
1198 |
|
<td><input name=credit size=10 value="|
|
1199 |
|
. $form->format_amount(\%myconfig, $form->{credit}, 2)
|
1200 |
|
. qq|" readonly > EUR</td>
|
1201 |
|
<td><input class=submit type=submit name=action value="|
|
1202 |
|
. $locale->text('Split Credit')
|
1203 |
|
. qq|"></td>
|
1204 |
|
<input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
|
1205 |
|
|;
|
1206 |
|
} else {
|
1207 |
|
print qq|
|
1208 |
|
<tr>
|
1209 |
|
<th align=right>| . $locale->text('Debit') . qq|</th>
|
1210 |
|
<td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
|
1211 |
|
<td><input name=debit size=10 value="|
|
1212 |
|
. $form->format_amount(\%myconfig, $form->{debit}, 2)
|
1213 |
|
. qq|" readonly> EUR</td>
|
1214 |
|
<td><input class=submit type=submit name=action value="|
|
1215 |
|
. $locale->text('Split Debit')
|
1216 |
|
. qq|"></td>
|
1217 |
|
<input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
|
1218 |
|
</tr>
|
1219 |
|
<tr>
|
1220 |
|
<th align=right>| . $locale->text('Credit') . qq|</th>
|
1221 |
|
<td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
|
1222 |
|
<td><input name=credit size=10 value="|
|
1223 |
|
. $form->format_amount(\%myconfig, $form->{credit}, 2)
|
1224 |
|
. qq|" readonly > EUR</td>
|
1225 |
|
<td><input class=submit type=submit name=action value="|
|
1226 |
|
. $locale->text('Split Credit')
|
1227 |
|
. qq|"></td>
|
1228 |
|
<input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
|
1229 |
|
</tr>
|
1230 |
|
<tr>
|
1231 |
|
<th align=right>| . $locale->text('Tax') . qq|</th>
|
1232 |
|
<td><select name=taxchartselected tabindex="7">$form->{taxchart}</select></td>
|
1233 |
|
<td><input name=tax size=10 value="|
|
1234 |
|
. $form->format_amount(\%myconfig, $form->{tax}, 2)
|
1235 |
|
. qq|" readonly > EUR</td>
|
1236 |
|
<td></td>
|
1237 |
|
</tr>|;
|
1238 |
1356 |
}
|
1239 |
1357 |
print qq|
|
1240 |
|
</tr> </table>
|
1241 |
|
</td>
|
1242 |
|
</tr>
|
1243 |
|
<tr>
|
1244 |
|
<td><hr size=3 noshade></td>
|
1245 |
|
</tr>
|
|
1358 |
<tr>
|
|
1359 |
<td colspan=4>
|
|
1360 |
<table width=100%>
|
|
1361 |
<tr class=listheading>
|
|
1362 |
<th class=listheading style="width:15%">|
|
|
1363 |
. $locale->text('Account') . qq|</th>
|
|
1364 |
<th class=listheading style="width:10%">|
|
|
1365 |
. $locale->text('Debit') . qq|</th>
|
|
1366 |
<th class=listheading style="width:10%">|
|
|
1367 |
. $locale->text('Credit') . qq|</th>
|
|
1368 |
<th class=listheading style="width:10%">|
|
|
1369 |
. $locale->text('Tax') . qq|</th>
|
|
1370 |
<th class=listheading style="width:5%">|
|
|
1371 |
. $locale->text('Korrektur') . qq|</th>
|
|
1372 |
<th class=listheading style="width:10%">|
|
|
1373 |
. $locale->text('Taxkey') . qq|</th>
|
|
1374 |
<th class=listheading style="width:20%">|
|
|
1375 |
. $locale->text('Source') . qq|</th>
|
|
1376 |
<th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
|
|
1377 |
$project
|
|
1378 |
</tr>
|
|
1379 |
|
1246 |
1380 |
$jsscript
|
1247 |
1381 |
|;
|
1248 |
|
|
1249 |
1382 |
$lxdebug->leave_sub();
|
|
1383 |
|
1250 |
1384 |
}
|
1251 |
1385 |
|
1252 |
1386 |
sub form_footer {
|
1253 |
1387 |
$lxdebug->enter_sub();
|
1254 |
1388 |
($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
|
1255 |
|
$dec = length $dec;
|
|
1389 |
$dec = length $dec;
|
1256 |
1390 |
$decimalplaces = ($dec > 2) ? $dec : 2;
|
1257 |
|
$taxrowcount =
|
1258 |
|
($form->{creditrowcount} > $form->{debitrowcount})
|
1259 |
|
? $form->{creditrowcount}
|
1260 |
|
: $form->{debitrowcount};
|
1261 |
1391 |
$radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
|
1262 |
1392 |
|
1263 |
1393 |
map {
|
1264 |
1394 |
$form->{$_} =
|
1265 |
|
$form->format_amount(\%myconfig, $form->{$_}, $decimalplaces, " ")
|
|
1395 |
$form->format_amount(\%myconfig, $form->{$_}, 2, " ")
|
1266 |
1396 |
} qw(totaldebit totalcredit);
|
1267 |
1397 |
|
1268 |
1398 |
print qq|
|
|
1399 |
<tr class=listtotal>
|
|
1400 |
<td></td>
|
|
1401 |
<th align=right class=listtotal> $form->{totaldebit}</th>
|
|
1402 |
<th align=right class=listtotal> $form->{totalcredit}</th>
|
|
1403 |
<td colspan=5></td>
|
|
1404 |
</tr>
|
|
1405 |
</table>
|
|
1406 |
</td>
|
|
1407 |
</tr>
|
1269 |
1408 |
</table>
|
1270 |
|
|;
|
1271 |
|
for $i (2 .. $form->{creditrowcount}) {
|
1272 |
|
print qq|
|
1273 |
|
<input type=hidden name=creditchartselected_$i value="$form->{"creditchartselected_$i"}">
|
1274 |
|
<input type=hidden name=credit_$i value="$form->{"credit_$i"}">
|
1275 |
|
|;
|
1276 |
|
}
|
1277 |
|
for $i (2 .. $form->{debitrowcount}) {
|
1278 |
|
print qq|
|
1279 |
|
<input type=hidden name=debitchartselected_$i value="$form->{"debitchartselected_$i"}">
|
1280 |
|
<input type=hidden name=debit_$i value="$form->{"debit_$i"}">
|
1281 |
|
|;
|
1282 |
|
}
|
1283 |
|
if ($taxrowcount > 1) {
|
1284 |
|
for $i (2 .. $taxrowcount) {
|
1285 |
|
print qq|
|
1286 |
|
<input type=hidden name=taxchartselected_$i value="$form->{"taxchartselected_$i"}">
|
1287 |
|
<input type=hidden name=tax_$i value="$form->{"tax_$i"}">
|
1288 |
|
|;
|
1289 |
|
}
|
1290 |
|
}
|
1291 |
|
print qq|
|
|
1409 |
|
1292 |
1410 |
<input type=hidden name=path value=$form->{path}>
|
1293 |
1411 |
<input type=hidden name=login value=$form->{login}>
|
1294 |
1412 |
<input type=hidden name=password value=$form->{password}>
|
1295 |
1413 |
|
1296 |
1414 |
<input name=callback type=hidden value="$form->{callback}">
|
|
1415 |
|
1297 |
1416 |
<br>
|
1298 |
1417 |
|;
|
1299 |
1418 |
|
... | ... | |
1310 |
1429 |
if (!$form->{locked} && $radieren) {
|
1311 |
1430 |
print qq|
|
1312 |
1431 |
<input class=submit type=submit name=action value="|
|
1313 |
|
. $locale->text('Post')
|
1314 |
|
. qq|" accesskey="b">
|
|
1432 |
. $locale->text('Post') . qq|" accesskey="b">
|
1315 |
1433 |
<input class=submit type=submit name=action value="|
|
1316 |
1434 |
. $locale->text('Delete') . qq|">|;
|
1317 |
1435 |
}
|
... | ... | |
1340 |
1458 |
</body>
|
1341 |
1459 |
</html>
|
1342 |
1460 |
";
|
1343 |
|
|
1344 |
1461 |
$lxdebug->leave_sub();
|
|
1462 |
|
1345 |
1463 |
}
|
1346 |
1464 |
|
1347 |
1465 |
sub delete {
|
... | ... | |
1374 |
1492 |
. $locale->text('Yes') . qq|">
|
1375 |
1493 |
</form>
|
1376 |
1494 |
|;
|
1377 |
|
|
1378 |
1495 |
$lxdebug->leave_sub();
|
|
1496 |
|
1379 |
1497 |
}
|
1380 |
1498 |
|
1381 |
1499 |
sub yes {
|
... | ... | |
1384 |
1502 |
$form->redirect($locale->text('Transaction deleted!'))
|
1385 |
1503 |
if (GL->delete_transaction(\%myconfig, \%$form));
|
1386 |
1504 |
$form->error($locale->text('Cannot delete transaction!'));
|
1387 |
|
|
1388 |
1505 |
$lxdebug->leave_sub();
|
|
1506 |
|
1389 |
1507 |
}
|
1390 |
1508 |
|
1391 |
1509 |
sub post {
|
... | ... | |
1399 |
1517 |
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
1400 |
1518 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
1401 |
1519 |
|
1402 |
|
($debitaccno, $debittaxkey) = split(/--/, $form->{debitchartselected});
|
1403 |
|
($creditaccno, $credittaxkey) = split(/--/, $form->{creditchartselected});
|
1404 |
|
|
1405 |
|
$credit_save = $form->{credit};
|
1406 |
|
$debit_save = $form->{debit};
|
1407 |
|
|
1408 |
1520 |
# check project
|
1409 |
1521 |
&check_project;
|
1410 |
|
($taxkey, $taxrate) = split(/--/, $form->{taxchartselected});
|
1411 |
1522 |
|
1412 |
|
if ($debittaxkey > 0) {
|
1413 |
|
$form->{taxchart} = $form->unescape($form->{taxchart});
|
1414 |
|
$form->{taxchart} =~ s/\"$debittaxkey--([^\"]*)\"/\"$debittaxkey--$1\"/;
|
|
1523 |
my @a = ();
|
|
1524 |
my $count = 0;
|
|
1525 |
my $debittax = 0;
|
|
1526 |
my $credittax = 0;
|
|
1527 |
my $debitcount = 0;
|
|
1528 |
my $creditcount = 0;
|
|
1529 |
$creditlock = 0;
|
|
1530 |
$debitlock = 0;
|
1415 |
1531 |
|
1416 |
|
$rate = ($form->{taxchart} =~ /selected/) ? $taxrate : $1;
|
1417 |
|
$form->{taxkey} =
|
1418 |
|
($form->{taxchart} =~ /selected/) ? $taxkey : $debittaxkey;
|
|
1532 |
my @flds =
|
|
1533 |
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
|
1419 |
1534 |
|
1420 |
|
if ($form->{storno}) {
|
1421 |
|
$form->{debit} = $form->parse_amount(\%myconfig, $form->{debit});
|
1422 |
|
$form->{credit} = $form->parse_amount(\%myconfig, $form->{credit});
|
1423 |
|
$form->{tax} = $form->parse_amount(\%myconfig, $form->{tax});
|
1424 |
|
} else {
|
1425 |
|
if ($form->{taxincluded}) {
|
1426 |
|
$form->{debit} =
|
1427 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1);
|
1428 |
|
$form->{credit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
1429 |
|
$form->{tax} =
|
1430 |
|
$form->parse_amount(\%myconfig, $form->{amount}) / ($rate + 1) *
|
1431 |
|
$rate;
|
|
1535 |
for my $i (1 .. $form->{rowcount}) {
|
|
1536 |
|
|
1537 |
unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
|
|
1538 |
for (qw(debit credit tax)) {
|
|
1539 |
$form->{"${_}_$i"} =
|
|
1540 |
$form->parse_amount(\%myconfig, $form->{"${_}_$i"});
|
|
1541 |
}
|
|
1542 |
|
|
1543 |
push @a, {};
|
|
1544 |
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
|
|
1545 |
|
|
1546 |
if ($debitcredit) {
|
|
1547 |
$debitcount++;
|
1432 |
1548 |
} else {
|
1433 |
|
$form->{debit} = $form->parse_amount(\%myconfig, $form->{amount}) * 1;
|
1434 |
|
$form->{credit} =
|
1435 |
|
$form->parse_amount(\%myconfig, $form->{amount}) * ($rate + 1);
|
1436 |
|
$form->{tax} =
|
1437 |
|
$form->parse_amount(\%myconfig, $form->{amount}) * $rate;
|
|
1549 |
$creditcount++;
|
|
1550 |
}
|
|
1551 |
|
|
1552 |
if (($debitcount >= 2) && ($creditcount == 2)) {
|
|
1553 |
$form->{"credit_$i"} = 0;
|
|
1554 |
$form->{"tax_$i"} = 0;
|
|
1555 |
$creditcount--;
|
|
1556 |
$creditlock = 1;
|
|
1557 |
}
|
|
1558 |
if (($creditcount >= 2) && ($debitcount == 2)) {
|
|
1559 |
$form->{"debit_$i"} = 0;
|
|
1560 |
$form->{"tax_$i"} = 0;
|
|
1561 |
$debitcount--;
|
|
1562 |
$debitlock = 1;
|
|
1563 |
}
|
|
1564 |
if (($creditcount == 1) && ($debitcount == 2)) {
|
|
1565 |
$creditlock = 1;
|
|
1566 |
}
|
|
1567 |
if (($creditcount == 2) && ($debitcount == 1)) {
|
|
1568 |
$debitlock = 1;
|
|
1569 |
}
|
|
1570 |
if ($debitcredit && $credittax) {
|
|
1571 |
$form->{"taxchart_$i"} = "0--0.00";
|
|
1572 |
}
|
|
1573 |
if (!$debitcredit && $debittax) {
|
|
1574 |
$form->{"taxchart_$i"} = "0--0.00";
|
|
1575 |
}
|
|
1576 |
$amount =
|
|
1577 |
($form->{"debit_$i"} == 0)
|
|
1578 |
? $form->{"credit_$i"}
|
Merge von 584-586,588,597 aus unstable: Splitbuchungen
-Buchungsjournal um Anzeige von Splitbuchungen erweitert, Splitbuchungen beim Dialogbuchen zu 80% fertig. Neue Maske fuer Splitbuchungen
Perltidy Lauf der Aenderungen zu Splittbuchungen
-Aenderungen fuer die Unterstuetzung von Splitbuchungen beim Dialogbuchen
-Aenderungen beim Dialogbuchen: Layout der Maske angepasst. Es kann nur eine Seite gesplittet werden, nur eine Seite kann Steuer haben