175 |
175 |
$form->{forex} = $form->{exchangerate};
|
176 |
176 |
$exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
|
177 |
177 |
foreach $key (keys %{ $form->{AR_links} }) {
|
178 |
|
|
179 |
|
foreach $ref (@{ $form->{AR_links}{$key} }) {
|
180 |
|
if ($key eq "AR_paid") {
|
181 |
|
$form->{"select$key"} .=
|
182 |
|
"<option value=\"$ref->{accno}\">$ref->{accno}--$ref->{description}</option>\n";
|
183 |
|
} else {
|
184 |
|
$form->{"select$key"} .=
|
185 |
|
"<option value=\"$ref->{accno}--$ref->{tax_id}\">$ref->{accno}--$ref->{description}</option>\n";
|
186 |
|
}
|
187 |
|
}
|
188 |
|
|
189 |
|
$form->{$key} = $form->{"select$key"};
|
190 |
|
|
191 |
178 |
# if there is a value we have an old entry
|
192 |
179 |
my $j = 0;
|
193 |
180 |
my $k = 0;
|
... | ... | |
195 |
182 |
for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
|
196 |
183 |
if ($key eq "AR_paid") {
|
197 |
184 |
$j++;
|
198 |
|
$form->{"AR_paid_$j"} =
|
199 |
|
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
|
|
185 |
$form->{"AR_paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{accno};
|
200 |
186 |
|
201 |
187 |
# reverse paid
|
202 |
188 |
$form->{"paid_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
|
... | ... | |
207 |
193 |
|
208 |
194 |
$form->{"forex_$j"} = $form->{"exchangerate_$i"} =
|
209 |
195 |
$form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
|
210 |
|
$form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
|
211 |
196 |
$form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
|
212 |
197 |
$form->{paidaccounts}++;
|
|
198 |
|
213 |
199 |
} else {
|
214 |
200 |
|
215 |
201 |
$akey = $key;
|
... | ... | |
254 |
240 |
$form->{"project_id_$k"} =
|
255 |
241 |
"$form->{acc_trans}{$key}->[$i-1]->{project_id}";
|
256 |
242 |
}
|
257 |
|
$form->{"${key}_$k"} =
|
258 |
|
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
|
259 |
243 |
$form->{"${key}_$i"} =
|
260 |
244 |
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
|
261 |
|
my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description});
|
262 |
|
$form->{"select${key}"} =~
|
263 |
|
/<option value=\"($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*)\">$form->{acc_trans}{$key}->[$i-1]->{accno}--${q_description}<\/option>\n/;
|
264 |
|
$form->{"${key}_$k"} = $1;
|
265 |
|
if ($akey eq 'amount') {
|
|
245 |
|
|
246 |
if ($akey eq "AR") {
|
|
247 |
$form->{ARselected} = $form->{acc_trans}{$key}->[$i-1]->{accno};
|
|
248 |
|
|
249 |
} elsif ($akey eq "amount") {
|
|
250 |
$form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} .
|
|
251 |
"--" . $form->{acc_trans}{$key}->[$i-1]->{id};
|
266 |
252 |
$form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} .
|
267 |
253 |
"--" . $form->{acc_trans}{$key}->[$i-1]->{rate};
|
268 |
254 |
}
|
... | ... | |
271 |
257 |
}
|
272 |
258 |
}
|
273 |
259 |
|
|
260 |
$lxdebug->message(0, "1 ARselected $form->{ARselected}");
|
|
261 |
|
274 |
262 |
$form->{taxincluded} = $taxincluded if ($form->{id});
|
275 |
263 |
$form->{paidaccounts} = 1 if not defined $form->{paidaccounts};
|
276 |
264 |
|
... | ... | |
296 |
284 |
($form->datetonum($form->{transdate}, \%myconfig) <=
|
297 |
285 |
$form->datetonum($form->{closedto}, \%myconfig));
|
298 |
286 |
|
299 |
|
$form->{"ARselected"} = $form->{"AR_1"};
|
300 |
|
|
301 |
287 |
$lxdebug->leave_sub();
|
302 |
288 |
}
|
303 |
289 |
|
... | ... | |
340 |
326 |
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
|
341 |
327 |
$readonly = ($form->{radier}) ? "" : $readonly;
|
342 |
328 |
|
343 |
|
my $ARselected_quoted = quotemeta($form->{"ARselected"});
|
344 |
|
$form->{selectAR} = $form->{AR};
|
345 |
|
$form->{selectAR} =~
|
346 |
|
s/value=\"${ARselected_quoted}\"/value=\"$form->{ARselected}\" selected/;
|
347 |
|
|
348 |
329 |
# set option selected
|
349 |
330 |
foreach $item (qw(customer currency department employee)) {
|
350 |
331 |
$form->{"select$item"} =~ s/ selected//;
|
351 |
332 |
$form->{"select$item"} =~
|
352 |
333 |
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
|
353 |
334 |
}
|
354 |
|
$selectAR_amount_unquoted = $form->{selectAR_amount};
|
355 |
|
map { $form->{$_} =~ s/\"/"/g }
|
356 |
|
qw(AR_amount selectAR_amount AR);
|
357 |
335 |
|
358 |
336 |
# format amounts
|
359 |
337 |
$form->{exchangerate} =
|
... | ... | |
433 |
411 |
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
|
434 |
412 |
"all" => 0,
|
435 |
413 |
"old_id" => \@old_project_ids },
|
|
414 |
"charts" => { "key" => "ALL_CHARTS",
|
|
415 |
"transdate" => $form->{transdate} },
|
436 |
416 |
"taxcharts" => "ALL_TAXCHARTS");
|
437 |
417 |
|
|
418 |
map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; }
|
|
419 |
@{ $form->{ALL_CHARTS} });
|
|
420 |
|
438 |
421 |
my %project_labels = ();
|
439 |
422 |
my @project_values = ("");
|
440 |
423 |
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
|
... | ... | |
442 |
425 |
$project_labels{$item->{"id"}} = $item->{"projectnumber"};
|
443 |
426 |
}
|
444 |
427 |
|
|
428 |
my (%AR_amount_labels, @AR_amount_values);
|
|
429 |
my (%AR_labels, @AR_values);
|
|
430 |
my (%AR_paid_labels, @AR_paid_values);
|
|
431 |
my $taxchart_init;
|
|
432 |
|
|
433 |
foreach my $item (@{ $form->{ALL_CHARTS} }) {
|
|
434 |
if (grep({ $_ eq "AR_amount" } @{ $item->{link_split} })) {
|
|
435 |
$taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
|
|
436 |
my $key = "$item->{accno}--$item->{tax_id}";
|
|
437 |
push(@AR_amount_values, $key);
|
|
438 |
$AR_amount_labels{$key} =
|
|
439 |
"$item->{accno}--$item->{description}";
|
|
440 |
|
|
441 |
} elsif (grep({ $_ eq "AR" } @{ $item->{link_split} })) {
|
|
442 |
push(@AR_values, $item->{accno});
|
|
443 |
$AR_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
|
|
444 |
|
|
445 |
} elsif (grep({ $_ eq "AR_paid" } @{ $item->{link_split} })) {
|
|
446 |
push(@AR_paid_values, $item->{accno});
|
|
447 |
$AR_paid_labels{$item->{accno}} =
|
|
448 |
"$item->{accno}--$item->{description}";
|
|
449 |
}
|
|
450 |
}
|
|
451 |
|
445 |
452 |
my %taxchart_labels = ();
|
446 |
453 |
my @taxchart_values = ();
|
447 |
454 |
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
|
448 |
|
my $key = Q($item->{id}) . "--" . Q($item->{rate});
|
449 |
|
$taxchart_init = $key if ($taxchart_init eq $item->{taxkey});
|
|
455 |
my $key = "$item->{id}--$item->{rate}";
|
|
456 |
$taxchart_init = $key if ($taxchart_init eq $item->{id});
|
450 |
457 |
push(@taxchart_values, $key);
|
451 |
|
$taxchart_labels{$key} = H($item->{taxdescription}) . " " .
|
452 |
|
H($item->{rate} * 100) . ' %';
|
|
458 |
$taxchart_labels{$key} =
|
|
459 |
"$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
|
453 |
460 |
}
|
454 |
461 |
|
455 |
462 |
$form->{fokus} = "arledger.customer";
|
... | ... | |
573 |
580 |
</tr>
|
574 |
581 |
|
575 |
582 |
$jsscript
|
576 |
|
<input type=hidden name=selectAR_amount value="$form->{selectAR_amount}">
|
577 |
|
<input type=hidden name=AR_amount value="$form->{AR_amount}">
|
578 |
583 |
<input type=hidden name=rowcount value=$form->{rowcount}>
|
579 |
584 |
<tr>
|
580 |
585 |
<td>
|
... | ... | |
604 |
609 |
$form->{"amount_$i"} =
|
605 |
610 |
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
|
606 |
611 |
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
|
607 |
|
$selectAR_amount = $selectAR_amount_unquoted;
|
608 |
|
$selectAR_amount =~
|
609 |
|
s/option value=\"$form->{"AR_amount_$i"}\"/option value=\"$form->{"AR_amount_$i"}\" selected/;
|
|
612 |
|
|
613 |
$selectAR_amount =
|
|
614 |
NTI($cgi->popup_menu('-name' => "AR_amount_$i",
|
|
615 |
'-id' => "AR_amount_$i",
|
|
616 |
'-style' => 'width:400px',
|
|
617 |
'-onChange' => "setTaxkey(this, $i)",
|
|
618 |
'-values' => \@AR_amount_values,
|
|
619 |
'-labels' => \%AR_amount_labels,
|
|
620 |
'-default' => $form->{"AR_amount_$i"}));
|
610 |
621 |
|
611 |
622 |
$tax = qq|<td>| .
|
612 |
|
$cgi->popup_menu('-name' => "taxchart_$i",
|
613 |
|
'-id' => "taxchart_$i",
|
614 |
|
'-style' => 'width:200px',
|
615 |
|
'-tabindex' => ($i + 10 + (($i - 1) * 8)),
|
616 |
|
'-values' => \@taxchart_values,
|
617 |
|
'-labels' => \%taxchart_labels,
|
618 |
|
'-default' => $form->{"taxchart_$i"})
|
|
623 |
NTI($cgi->popup_menu('-name' => "taxchart_$i",
|
|
624 |
'-id' => "taxchart_$i",
|
|
625 |
'-style' => 'width:200px',
|
|
626 |
'-values' => \@taxchart_values,
|
|
627 |
'-labels' => \%taxchart_labels,
|
|
628 |
'-default' => $form->{"taxchart_$i"} eq "" ?
|
|
629 |
$taxchart_init : $form->{"taxchart_$i"}))
|
619 |
630 |
. qq|</td>|;
|
620 |
631 |
|
621 |
632 |
$korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
|
... | ... | |
628 |
639 |
|
629 |
640 |
print qq|
|
630 |
641 |
<tr>
|
631 |
|
<td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
|
|
642 |
<td>$selectAR_amount</td>
|
632 |
643 |
<td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
|
633 |
644 |
<td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
|
634 |
645 |
<td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
|
... | ... | |
642 |
653 |
|
643 |
654 |
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
|
644 |
655 |
|
|
656 |
$ARselected =
|
|
657 |
NTI($cgi->popup_menu('-name' => "ARselected", '-id' => "ARselected",
|
|
658 |
'-style' => 'width:400px',
|
|
659 |
'-values' => \@AR_values, '-labels' => \%AR_labels,
|
|
660 |
'-default' => $form->{ARselected}));
|
|
661 |
|
645 |
662 |
print qq|
|
646 |
663 |
<tr>
|
647 |
664 |
<td colspan=6>
|
... | ... | |
649 |
666 |
</td>
|
650 |
667 |
</tr>
|
651 |
668 |
<tr>
|
652 |
|
<td><select name=ARselected>$form->{selectAR}</select></td>
|
653 |
|
<input type=hidden name=AR value="$form->{AR}">
|
|
669 |
<td>${ARselected}</td>
|
654 |
670 |
<th align=left>$form->{invtotal}</th>
|
655 |
671 |
|
656 |
672 |
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
|
... | ... | |
713 |
729 |
<tr>
|
714 |
730 |
";
|
715 |
731 |
|
716 |
|
$form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
|
717 |
|
$form->{"selectAR_paid_$i"} =~
|
718 |
|
s/option value=\"$form->{"AR_paid_$i"}\">/option value=\"$form->{"AR_paid_$i"}\" selected>/;
|
|
732 |
$selectAR_paid =
|
|
733 |
NTI($cgi->popup_menu('-name' => "AR_paid_$i",
|
|
734 |
'-id' => "AR_paid_$i",
|
|
735 |
'-values' => \@AR_paid_values,
|
|
736 |
'-labels' => \%AR_paid_labels,
|
|
737 |
'-default' => $form->{"AR_paid_$i"}));
|
719 |
738 |
|
720 |
739 |
# format amounts
|
721 |
740 |
if ($form->{"paid_$i"}) {
|
... | ... | |
743 |
762 |
$column_data{paid} =
|
744 |
763 |
qq|<td align=center><input name="paid_$i" size=11 value=$form->{"paid_$i"}></td>|;
|
745 |
764 |
$column_data{AR_paid} =
|
746 |
|
qq|<td align=center><select name="AR_paid_$i">$form->{"selectAR_paid_$i"}</select></td>|;
|
|
765 |
qq|<td align=center>${selectAR_paid}</td>|;
|
747 |
766 |
$column_data{exchangerate} = qq|<td align=center>$exchangerate</td>|;
|
748 |
767 |
$column_data{datepaid} =
|
749 |
768 |
qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 value=$form->{"datepaid_$i"}>
|
... | ... | |
768 |
787 |
";
|
769 |
788 |
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
|
770 |
789 |
}
|
771 |
|
map { $form->{$_} =~ s/\"/"/g } qw(selectAR_paid);
|
772 |
790 |
|
773 |
791 |
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
|
774 |
792 |
qq|
|
775 |
793 |
<input type=hidden name=paidaccounts value=$form->{paidaccounts}>
|
776 |
|
<input type=hidden name=selectAR_paid value="$form->{selectAR_paid}">
|
777 |
794 |
|
778 |
795 |
</table>
|
779 |
796 |
</td>
|
... | ... | |
1031 |
1048 |
exit;
|
1032 |
1049 |
}
|
1033 |
1050 |
|
1034 |
|
my ($creditaccno, $credittaxkey) = split /--/, $form->{AR_amountselected};
|
1035 |
|
my ($receivablesaccno, $payablestaxkey) = split /--/, $form->{ARselected};
|
1036 |
|
$form->{AR}{amount_1} = $creditaccno;
|
1037 |
|
$form->{AR}{receivables} = $receivablesaccno;
|
|
1051 |
$form->{AR}{receivables} = $form->{ARselected};
|
1038 |
1052 |
|
1039 |
1053 |
$form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
|
1040 |
1054 |
unless $form->{invnumber};
|
Dialogbuchen: Weitere Drop-Down-Boxen werden bei jedem Aufbau aus der Datenbank ausgelesen und durch das CGI-Modul ausgegeben.