X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTaxkeys.pm;h=a682dc22cb421483e52426b5800161898fd3f4dc;hb=43816cb7289ee9225c3bb229d077bd87a75562cc;hp=8d90dcb3c8cd53a647943ee2270b3cd16436be1b;hpb=eb0c10b0a09da8ff4590c3043a9fa6dd10775ee4;p=kivitendo-erp.git diff --git a/SL/Taxkeys.pm b/SL/Taxkeys.pm index 8d90dcb3c..a682dc22c 100644 --- a/SL/Taxkeys.pm +++ b/SL/Taxkeys.pm @@ -1,11 +1,11 @@ package Taxkeys; -use strict; - use Memoize; use SL::DBUtils; +use strict; + sub new { my $type = shift; @@ -60,7 +60,7 @@ sub get_tax_info { if (!$self->{handles}->{get_tax_info}) { $self->{queries}->{get_tax_info} = qq| - SELECT t.rate AS taxrate, t.taxnumber, t.taxdescription, t.chart_id AS taxchart_id, + SELECT t.rate AS taxrate, c.accno as taxnumber, t.taxdescription, t.chart_id AS taxchart_id, c.accno AS taxaccno, c.description AS taxaccount FROM taxkeys tk LEFT JOIN tax t ON (tk.tax_id = t.id) @@ -78,7 +78,8 @@ sub get_tax_info { } my $sth = $self->{handles}->{get_tax_info}; - do_statement($form, $sth, $self->{queries}->{get_tax_info}, $params{taxkey}, $params{transdate}); + # Lieferdatum (deliverydate) ist entscheidend für den Steuersatz + do_statement($form, $sth, $self->{queries}->{get_tax_info}, $params{taxkey}, $params{deliverydate} || $params{transdate}); my $ref = $sth->fetchrow_hashref() || { }; @@ -106,7 +107,7 @@ sub get_full_tax_info { my @all_taxkeys = map { $_->{taxkey} } (selectall_hashref_query($form, $form->get_standard_dbh(), qq|SELECT DISTINCT taxkey FROM tax WHERE taxkey IS NOT NULL|)); foreach my $taxkey (@all_taxkeys) { - my $ref = $self->get_tax_info('transdate' => $params{transdate}, 'taxkey' => $taxkey); + my $ref = $self->get_tax_info('transdate' => $params{transdate}, 'taxkey' => $taxkey, 'deliverydate' => $params{deliverydate}); $tax_info{taxkeys}->{$taxkey} = $ref; $tax_info{accnos}->{$ref->{taxchart_id}} = $ref if ($ref->{taxchart_id});