From 6aefd19def6a7d2f205e5401451e4c0bf3cebc46 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 6 Mar 2007 14:27:21 +0000 Subject: [PATCH] =?utf8?q?Dialogbuchen,=20Debitorenbuchungen:=20Wird=20das?= =?utf8?q?=20transdate=20ver=C3=A4ndert,=20so=20wird=20eventuell=20auch=20?= =?utf8?q?der=20Steuerschl=C3=BCssel=20ge=C3=A4ndert.=20Auch=20in=20diesem?= =?utf8?q?=20Fall=20m=C3=BCssen=20die=20ausgew=C3=A4hlten=20Konten=20beibe?= =?utf8?q?halten=20werden.=20Die=20Steuerkonten=20werden=20in=20so=20einem?= =?utf8?q?=20Fall=20aber=20auf=20das=20mit=20dem=20ausgew=C3=A4hlten=20Kon?= =?utf8?q?to=20verkn=C3=BCpften=20Steuerkonto=20gesetzt.=20Fix=20f=C3=BCr?= =?utf8?q?=20Bug=20577.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ar.pl | 31 ++++++++++++++++++++++++++++--- bin/mozilla/gl.pl | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 5b3e3b2a1..9f003d324 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -428,6 +428,7 @@ sub form_header { my (%AR_amount_labels, @AR_amount_values); my (%AR_labels, @AR_values); my (%AR_paid_labels, @AR_paid_values); + my %charts; my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { @@ -447,16 +448,20 @@ sub form_header { $AR_paid_labels{$item->{accno}} = "$item->{accno}--$item->{description}"; } + + $charts{$item->{accno}} = $item; } my %taxchart_labels = (); my @taxchart_values = (); + my %taxcharts = (); foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { my $key = "$item->{id}--$item->{rate}"; $taxchart_init = $key if ($taxchart_init eq $item->{id}); push(@taxchart_values, $key); $taxchart_labels{$key} = "$item->{taxdescription} " . ($item->{rate} * 100) . ' %'; + $taxcharts{$item->{id}} = $item; } $form->{fokus} = "arledger.customer"; @@ -610,6 +615,25 @@ $jsscript $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); + my $selected_accno_full; + my ($accno_row) = split(/--/, $form->{"AR_amount_$i"}); + my $item = $charts{$accno_row}; + $selected_accno_full = "$item->{accno}--$item->{tax_id}"; + + my $selected_taxchart = $form->{"taxchart_$i"}; + my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); + my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AR_amount_$i"}); + + if ($previous_accno && + ($previous_accno eq $selected_accno) && + ($previous_tax_id ne $selected_tax_id)) { + $lxdebug->message(0, "yeah"); + my $item = $taxcharts{$selected_tax_id}; + $selected_taxchart = "$item->{id}--$item->{rate}"; + } + + $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); + $selectAR_amount = NTI($cgi->popup_menu('-name' => "AR_amount_$i", '-id' => "AR_amount_$i", @@ -617,7 +641,9 @@ $jsscript '-onChange' => "setTaxkey(this, $i)", '-values' => \@AR_amount_values, '-labels' => \%AR_amount_labels, - '-default' => $form->{"AR_amount_$i"})); + '-default' => $selected_accno_full)) + . $cgi->hidden('-name' => "previous_AR_amount_$i", + '-default' => $selected_accno_full); $tax = qq|| . NTI($cgi->popup_menu('-name' => "taxchart_$i", @@ -625,8 +651,7 @@ $jsscript '-style' => 'width:200px', '-values' => \@taxchart_values, '-labels' => \%taxchart_labels, - '-default' => $form->{"taxchart_$i"} eq "" ? - $taxchart_init : $form->{"taxchart_$i"})) + '-default' => $selected_taxchart)) . qq||; $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : ''); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index d0616ab1a..7c7fa843e 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1086,22 +1086,26 @@ sub display_rows { my %chart_labels = (); my @chart_values = (); + my %charts = (); my $taxchart_init; foreach my $item (@{ $form->{ALL_CHARTS} }) { my $key = Q($item->{accno}) . "--" . Q($item->{tax_id}); $taxchart_init = $item->{taxkey_id} unless (@chart_values); push(@chart_values, $key); $chart_labels{$key} = H($item->{accno}) . "--" . H($item->{description}); + $charts{$item->{accno}} = $item; } my %taxchart_labels = (); my @taxchart_values = (); + my %taxcharts = (); foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { my $key = Q($item->{id}) . "--" . Q($item->{rate}); $taxchart_init = $key if ($taxchart_init eq $item->{taxkey}); push(@taxchart_values, $key); $taxchart_labels{$key} = H($item->{taxdescription}) . " " . H($item->{rate} * 100) . ' %'; + $taxcharts{$item->{id}} = $item; } for $i (1 .. $form->{rowcount}) { @@ -1113,6 +1117,28 @@ sub display_rows { |; + my $selected_accno_full; + my ($accno_row) = split(/--/, $form->{"accno_$i"}); + my $item = $charts{$accno_row}; + $selected_accno_full = "$item->{accno}--$item->{tax_id}"; + + my $selected_taxchart = $form->{"taxchart_$i"}; + my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); + my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_accno_$i"}); + + if ($previous_accno && + ($previous_accno eq $selected_accno) && + ($previous_tax_id ne $selected_tax_id)) { + $lxdebug->message(0, "yeah"); + my $item = $taxcharts{$selected_tax_id}; + $selected_taxchart = "$item->{id}--$item->{rate}"; + } + + if ($init) { + $selected_accno = ''; + $selected_taxchart = $taxchart_init; + } + $accno = qq|| . $cgi->popup_menu('-name' => "accno_$i", '-id' => "accno_$i", @@ -1121,7 +1147,9 @@ sub display_rows { '-tabindex' => ($i + 5 + (($i - 1) * 8)), '-values' => \@chart_values, '-labels' => \%chart_labels, - '-default' => $init ? '' : $form->{"accno_$i"}) + '-default' => $selected_accno_full) + . $cgi->hidden('-name' => "previous_accno_$i", + '-default' => $selected_accno_full) . qq||; $tax = qq|| . $cgi->popup_menu('-name' => "taxchart_$i", @@ -1130,7 +1158,7 @@ sub display_rows { '-tabindex' => ($i + 10 + (($i - 1) * 8)), '-values' => \@taxchart_values, '-labels' => \%taxchart_labels, - '-default' => $init ? $taxchart_init : $form->{"taxchart_$i"}) + '-default' => $selected_taxchart) . qq||; if ($init) { -- 2.20.1