From: Moritz Bunkus Date: Tue, 6 Mar 2007 16:00:31 +0000 (+0000) Subject: Debitorenrechnungen: Beim Erstellen einer neuen Debitorenrechnung das richtige Steuer... X-Git-Tag: release-2.4.3^2~618 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f1c1921d65bf08dc5e31bad92cb078e9e10d98fe;p=kivitendo-erp.git Debitorenrechnungen: Beim Erstellen einer neuen Debitorenrechnung das richtige Steuerkonto für die erste Zeile auswählen, auch wenn das ausgewählte Konto nicht das erste Konto in der Liste ist. --- diff --git a/SL/IS.pm b/SL/IS.pm index 1ee47f209..2766ce2cd 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1844,7 +1844,7 @@ sub get_customer { # setup last accounts used for this customer if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) { - $query = qq|SELECT c.accno, c.description, c.link, c.category + $query = qq|SELECT c.id, c.accno, c.description, c.link, c.category FROM chart c JOIN acc_trans ac ON (ac.chart_id = c.id) JOIN ar a ON (a.id = ac.trans_id) @@ -1860,6 +1860,18 @@ sub get_customer { if ($ref->{category} eq 'I') { $i++; $form->{"AR_amount_$i"} = "$ref->{accno}--$ref->{description}"; + + if ($form->{initial_transdate}) { + my $tax_query = + qq|SELECT tk.tax_id, t.rate FROM taxkeys tk | . + qq|LEFT JOIN tax t ON tk.tax_id = t.id | . + qq|WHERE tk.chart_id = ? AND startdate <= ? | . + qq|ORDER BY tk.startdate DESC LIMIT 1|; + my ($tax_id, $rate) = + selectrow_query($form, $dbh, $tax_query, $ref->{id}, + $form->{initial_transdate}); + $form->{"taxchart_$i"} = "${tax_id}--${rate}"; + } } if ($ref->{category} eq 'A') { $form->{ARselected} = $form->{AR_1} = $ref->{accno}; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 9f003d324..04ddffe41 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -89,8 +89,10 @@ sub add { "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; - &create_links; AR->get_transdate(\%myconfig, $form); + $form->{initial_transdate} = $form->{transdate}; + &create_links; + $form->{transdate} = $form->{initial_transdate}; &display_form; $lxdebug->leave_sub(); } @@ -257,8 +259,6 @@ sub create_links { } } - $lxdebug->message(0, "1 ARselected $form->{ARselected}"); - $form->{taxincluded} = $taxincluded if ($form->{id}); $form->{paidaccounts} = 1 if not defined $form->{paidaccounts}; @@ -627,7 +627,6 @@ $jsscript 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}"; } diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 253b97ee4..0a7d44f84 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1127,7 +1127,6 @@ sub display_rows { 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}"; }