82 |
82 |
"$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}"
|
83 |
83 |
unless $form->{callback};
|
84 |
84 |
|
85 |
|
&create_links;
|
86 |
85 |
AP->get_transdate(\%myconfig, $form);
|
|
86 |
$form->{initial_transdate} = $form->{transdate};
|
|
87 |
&create_links;
|
|
88 |
$form->{transdate} = $form->{initial_transdate};
|
87 |
89 |
&display_form;
|
88 |
90 |
|
89 |
91 |
$lxdebug->leave_sub();
|
... | ... | |
128 |
130 |
# build the popup menus
|
129 |
131 |
$form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked";
|
130 |
132 |
|
131 |
|
map {
|
132 |
|
$tax .=
|
133 |
|
qq|<option value=\"$_->{id}--$_->{rate}\">$_->{taxdescription} |
|
134 |
|
. ($_->{rate} * 100) . qq| %|
|
135 |
|
} @{ $form->{TAX} };
|
136 |
|
$form->{taxchart} = $tax;
|
137 |
|
$form->{selecttaxchart} = $tax;
|
138 |
|
|
139 |
133 |
# currencies
|
140 |
134 |
@curr = split(/:/, $form->{currencies});
|
141 |
135 |
chomp $curr[0];
|
... | ... | |
217 |
211 |
if ($form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"} > 0) {
|
218 |
212 |
$totaltax +=
|
219 |
213 |
$form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
|
220 |
|
$taxrate +=
|
221 |
|
$form->{"$form->{acc_trans}{$key}->[$i-1]->{accno}_rate"};
|
222 |
214 |
} else {
|
223 |
215 |
$totalwithholding +=
|
224 |
216 |
$form->{"${akey}_$form->{acc_trans}{$key}->[$i-1]->{accno}"};
|
... | ... | |
252 |
244 |
$form->{"select${key}"} =~
|
253 |
245 |
/<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
|
254 |
246 |
$form->{"${key}_$k"} = $1;
|
255 |
|
if ($akey eq 'amount') {
|
256 |
|
$form->{"taxchart_$k"} = $form->{taxchart};
|
257 |
|
$form->{"taxchart_$k"} =~
|
258 |
|
/<option value=\"($form->{acc_trans}{$key}->[$i-1]->{id}--[^\"]*)/;
|
259 |
|
$form->{"taxchart_$k"} = $1;
|
|
247 |
|
|
248 |
if ($akey eq "AP") {
|
|
249 |
$form->{APselected} = $form->{acc_trans}{$key}->[$i-1]->{accno};
|
|
250 |
|
|
251 |
} elsif ($akey eq 'amount') {
|
|
252 |
$form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} .
|
|
253 |
"--" . $form->{acc_trans}{$key}->[$i-1]->{id};
|
|
254 |
$form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} .
|
|
255 |
"--" . $form->{acc_trans}{$key}->[$i-1]->{rate};
|
260 |
256 |
}
|
261 |
257 |
}
|
262 |
258 |
}
|
... | ... | |
287 |
283 |
($form->datetonum($form->{transdate}, \%myconfig) <=
|
288 |
284 |
$form->datetonum($form->{closedto}, \%myconfig));
|
289 |
285 |
|
290 |
|
$form->{"APselected"} = $form->{"AP_1"};
|
291 |
|
|
292 |
286 |
$lxdebug->leave_sub();
|
293 |
287 |
}
|
294 |
288 |
|
... | ... | |
331 |
325 |
}
|
332 |
326 |
$readonly = ($form->{id}) ? "readonly" : "";
|
333 |
327 |
|
334 |
|
my $APselected_quoted = quotemeta($form->{"APselected"});
|
335 |
|
$form->{selectAP} = $form->{AP};
|
336 |
|
$form->{selectAP} =~
|
337 |
|
s/value=\"${APselected_quoted}\"/value=\"$form->{APselected}\" selected/;
|
338 |
|
|
339 |
328 |
$form->{radier} =
|
340 |
329 |
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
|
341 |
330 |
$readonly = ($form->{radier}) ? "" : $readonly;
|
342 |
|
$selectAP_amount_unquoted = $form->{selectAP_amount};
|
343 |
|
$taxchart = $form->{taxchart};
|
344 |
|
map { $form->{$_} =~ s/\"/"/g }
|
345 |
|
qw(AP_amount selectAP_amount AP taxchart);
|
346 |
331 |
|
347 |
332 |
# format amounts
|
348 |
333 |
$form->{exchangerate} =
|
... | ... | |
410 |
395 |
|
411 |
396 |
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
|
412 |
397 |
"all" => 0,
|
413 |
|
"old_id" => \@old_project_ids });
|
|
398 |
"old_id" => \@old_project_ids },
|
|
399 |
"charts" => { "key" => "ALL_CHARTS",
|
|
400 |
"transdate" => $form->{transdate} },
|
|
401 |
"taxcharts" => "ALL_TAXCHARTS");
|
|
402 |
|
|
403 |
map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; }
|
|
404 |
@{ $form->{ALL_CHARTS} });
|
414 |
405 |
|
415 |
406 |
my %project_labels = ();
|
416 |
407 |
my @project_values = ("");
|
... | ... | |
419 |
410 |
$project_labels{$item->{"id"}} = $item->{"projectnumber"};
|
420 |
411 |
}
|
421 |
412 |
|
|
413 |
my (%AP_amount_labels, @AP_amount_values);
|
|
414 |
my (%AP_labels, @AP_values);
|
|
415 |
my (%AP_paid_labels, @AP_paid_values);
|
|
416 |
my %charts;
|
|
417 |
my $taxchart_init;
|
|
418 |
|
|
419 |
foreach my $item (@{ $form->{ALL_CHARTS} }) {
|
|
420 |
if (grep({ $_ eq "AP_amount" } @{ $item->{link_split} })) {
|
|
421 |
$taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
|
|
422 |
my $key = "$item->{accno}--$item->{tax_id}";
|
|
423 |
push(@AP_amount_values, $key);
|
|
424 |
$AP_amount_labels{$key} =
|
|
425 |
"$item->{accno}--$item->{description}";
|
|
426 |
|
|
427 |
} elsif (grep({ $_ eq "AP" } @{ $item->{link_split} })) {
|
|
428 |
push(@AP_values, $item->{accno});
|
|
429 |
$AP_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
|
|
430 |
|
|
431 |
} elsif (grep({ $_ eq "AP_paid" } @{ $item->{link_split} })) {
|
|
432 |
push(@AP_paid_values, $item->{accno});
|
|
433 |
$AP_paid_labels{$item->{accno}} =
|
|
434 |
"$item->{accno}--$item->{description}";
|
|
435 |
}
|
|
436 |
|
|
437 |
$charts{$item->{accno}} = $item;
|
|
438 |
}
|
|
439 |
|
|
440 |
my %taxchart_labels = ();
|
|
441 |
my @taxchart_values = ();
|
|
442 |
my %taxcharts = ();
|
|
443 |
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
|
|
444 |
my $key = "$item->{id}--$item->{rate}";
|
|
445 |
$taxchart_init = $key if ($taxchart_init eq $item->{id});
|
|
446 |
push(@taxchart_values, $key);
|
|
447 |
$taxchart_labels{$key} =
|
|
448 |
"$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
|
|
449 |
$taxcharts{$item->{id}} = $item;
|
|
450 |
}
|
|
451 |
|
422 |
452 |
# use JavaScript Calendar or not
|
423 |
453 |
$form->{jsscript} = $jscalendar;
|
424 |
454 |
$jsscript = "";
|
... | ... | |
538 |
568 |
|
539 |
569 |
|
540 |
570 |
$jsscript
|
541 |
|
<input type=hidden name=selectAP_amount value="$form->{selectAP_amount}">
|
542 |
|
<input type=hidden name=AP_amount value="$form->{AP_amount}">
|
543 |
|
<input type=hidden name=taxchart value="$form->{taxchart}">
|
544 |
571 |
<input type=hidden name=rowcount value=$form->{rowcount}>
|
545 |
572 |
<tr>
|
546 |
573 |
<td>
|
... | ... | |
570 |
597 |
$form->{"amount_$i"} =
|
571 |
598 |
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
|
572 |
599 |
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
|
573 |
|
$selectAP_amount = $selectAP_amount_unquoted;
|
574 |
|
$re_amount = quotemeta($form->{"AP_amount_$i"});
|
575 |
|
$selectAP_amount =~
|
576 |
|
s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
|
577 |
|
$tax = $taxchart;
|
578 |
|
$tax_selected = $form->{"taxchart_$i"};
|
579 |
|
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
|
580 |
|
$tax =
|
581 |
|
qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
|
|
600 |
|
|
601 |
my $selected_accno_full;
|
|
602 |
my ($accno_row) = split(/--/, $form->{"AP_amount_$i"});
|
|
603 |
my $item = $charts{$accno_row};
|
|
604 |
$selected_accno_full = "$item->{accno}--$item->{tax_id}";
|
|
605 |
|
|
606 |
my $selected_taxchart = $form->{"taxchart_$i"};
|
|
607 |
my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
|
|
608 |
my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AP_amount_$i"});
|
|
609 |
|
|
610 |
if ($previous_accno &&
|
|
611 |
($previous_accno eq $selected_accno) &&
|
|
612 |
($previous_tax_id ne $selected_tax_id)) {
|
|
613 |
my $item = $taxcharts{$selected_tax_id};
|
|
614 |
$selected_taxchart = "$item->{id}--$item->{rate}";
|
|
615 |
}
|
|
616 |
|
|
617 |
$selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
|
|
618 |
|
|
619 |
$selectAP_amount =
|
|
620 |
NTI($cgi->popup_menu('-name' => "AP_amount_$i",
|
|
621 |
'-id' => "AP_amount_$i",
|
|
622 |
'-style' => 'width:400px',
|
|
623 |
'-onChange' => "setTaxkey(this, $i)",
|
|
624 |
'-values' => \@AP_amount_values,
|
|
625 |
'-labels' => \%AP_amount_labels,
|
|
626 |
'-default' => $selected_accno_full))
|
|
627 |
. $cgi->hidden('-name' => "previous_AP_amount_$i",
|
|
628 |
'-default' => $selected_accno_full);
|
|
629 |
|
|
630 |
$tax = qq|<td>| .
|
|
631 |
NTI($cgi->popup_menu('-name' => "taxchart_$i",
|
|
632 |
'-id' => "taxchart_$i",
|
|
633 |
'-style' => 'width:200px',
|
|
634 |
'-values' => \@taxchart_values,
|
|
635 |
'-labels' => \%taxchart_labels,
|
|
636 |
'-default' => $selected_taxchart))
|
|
637 |
. qq|</td>|;
|
582 |
638 |
|
583 |
639 |
my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
|
584 |
640 |
|
... | ... | |
590 |
646 |
|
591 |
647 |
print qq|
|
592 |
648 |
<tr>
|
593 |
|
<td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
|
|
649 |
<td>$selectAP_amount</td>
|
594 |
650 |
<td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
|
595 |
651 |
<td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
|
596 |
652 |
<td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
|
... | ... | |
609 |
665 |
|
610 |
666 |
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
|
611 |
667 |
|
|
668 |
$APselected =
|
|
669 |
NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
|
|
670 |
'-style' => 'width:400px',
|
|
671 |
'-values' => \@AP_values, '-labels' => \%AP_labels,
|
|
672 |
'-default' => $form->{APselected}));
|
612 |
673 |
print qq|
|
613 |
674 |
<tr>
|
614 |
675 |
<td colspan=6>
|
... | ... | |
616 |
677 |
</td>
|
617 |
678 |
</tr>
|
618 |
679 |
<tr>
|
619 |
|
<td><select name=APselected>$form->{selectAP}</select></td>
|
620 |
|
<input type=hidden name=AP value="$form->{AP}">
|
|
680 |
<td>${APselected}</td>
|
621 |
681 |
<th align=left>$form->{invtotal}</th>
|
622 |
682 |
|
623 |
683 |
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
|
... | ... | |
679 |
739 |
<tr>
|
680 |
740 |
";
|
681 |
741 |
|
682 |
|
$form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
|
683 |
|
$form->{"selectAP_paid_$i"} =~
|
684 |
|
s/option value=\"$form->{"AP_paid_$i"}\">/option value=\"$form->{"AP_paid_$i"}\" selected>/;
|
|
742 |
$selectAP_paid =
|
|
743 |
NTI($cgi->popup_menu('-name' => "AP_paid_$i",
|
|
744 |
'-id' => "AP_paid_$i",
|
|
745 |
'-values' => \@AP_paid_values,
|
|
746 |
'-labels' => \%AP_paid_labels,
|
|
747 |
'-default' => $form->{"AP_paid_$i"}));
|
685 |
748 |
|
686 |
749 |
# format amounts
|
687 |
750 |
if ($form->{"paid_$i"}) {
|
... | ... | |
709 |
772 |
$column_data{"paid_$i"} =
|
710 |
773 |
qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
|
711 |
774 |
$column_data{"AP_paid_$i"} =
|
712 |
|
qq|<td align=center><select name="AP_paid_$i">$form->{"selectAP_paid_$i"}</select></td>|;
|
|
775 |
qq|<td align=center>${selectAP_paid}</td>|;
|
713 |
776 |
$column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|;
|
714 |
777 |
$column_data{"datepaid_$i"} =
|
715 |
778 |
qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value=$form->{"datepaid_$i"}>
|
... | ... | |
733 |
796 |
";
|
734 |
797 |
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
|
735 |
798 |
}
|
736 |
|
map { $form->{$_} =~ s/\"/"/g } qw(selectAP_paid);
|
737 |
799 |
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
|
738 |
800 |
qq|
|
739 |
801 |
<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
|
740 |
|
<input type=hidden name=selectAP_paid value="$form->{selectAP_paid}">
|
741 |
802 |
|
742 |
803 |
</table>
|
743 |
804 |
</td>
|
... | ... | |
770 |
831 |
<br>
|
771 |
832 |
|;
|
772 |
833 |
|
|
834 |
if (!$form->{id} && $form->{draft_id}) {
|
|
835 |
print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
|
|
836 |
'-value' => 1, '-checked' => $form->{remove_draft},
|
|
837 |
'-label' => '')) .
|
|
838 |
qq| <label for="remove_draft">| .
|
|
839 |
$locale->text("Remove draft when posting") .
|
|
840 |
qq|</label><br>|);
|
|
841 |
}
|
|
842 |
|
773 |
843 |
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
774 |
844 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
775 |
845 |
|
... | ... | |
827 |
897 |
|
828 |
898 |
my $display = shift;
|
829 |
899 |
|
830 |
|
# if ($display) {
|
831 |
|
# goto TAXCALC;
|
832 |
|
# }
|
833 |
|
|
834 |
900 |
$form->{invtotal} = 0;
|
835 |
901 |
|
836 |
|
# $form->{selectAP_amount} = $form->{AP_amount};
|
837 |
|
# $form->{selectAP_amount} =~
|
838 |
|
# s/value=\"$form->{AP_amountselected}\"/value=\"$form->{AP_amountselected}\" selected/;
|
839 |
|
|
840 |
|
($AP_amountaccno, $AP_amounttaxkey) =
|
841 |
|
split(/--/, $form->{AP_amountselected});
|
842 |
|
$form->{selecttaxchart} = $form->{taxchart};
|
843 |
|
$form->{selecttaxchart} =~
|
844 |
|
s/value=\"$AP_amounttaxkey--([^\"]*)\"/value=\"$AP_amounttaxkey--$1\" selected/;
|
845 |
|
|
846 |
|
$form->{rate} = $1;
|
847 |
|
|
848 |
902 |
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
|
849 |
903 |
qw(exchangerate creditlimit creditremaining);
|
850 |
904 |
|
Kreditorenrechnungsmaske: Drop-Down-Boxen für Konten werden jetzt bei jedem Seitenaufbau richtig aufgebaut (kein Mitschleppen der HTML-gecodeten Drop-Down-Box im Formular) analog zu ar.pl. Behebt außerdem ein paar Bugs mit Auswahl der Steuerschlüssel.