X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FIC.pm;h=74cfe17023fa683234f52db6ad368d424a4ece55;hb=e770cd180600810fecd3554e104546236a9c9597;hp=4b48dcc4f3f702ae19a50b564e77a4c99197b85c;hpb=49556f01cfe6a395cf5554e1a00dc61d6da0493e;p=kivitendo-erp.git diff --git a/SL/IC.pm b/SL/IC.pm index 4b48dcc4f..74cfe1702 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1487,8 +1487,22 @@ sub retrieve_accounts { # transdate madness. my $transdate = ""; - if ($form->{type} eq "invoice") { - if (($form->{vc} eq "vendor") || !$form->{deliverydate}) { + if ($form->{type} eq "invoice" or $form->{type} eq "credit_note") { + # use deliverydate for sales and purchase invoice, if it exists + # also use deliverydate for credit notes + if (!$form->{deliverydate}) { + $transdate = $form->{invdate}; + } else { + $transdate = $form->{deliverydate}; + } + } elsif ($form->{script} eq 'ir.pl') { + # when a purchase invoice is opened from the report of purchase invoices + # $form->{type} isn't set, but $form->{script} is, not sure why this is or + # whether this distinction matters in some other scenario. Otherwise one + # could probably take out this elsif and add a + # " or $form->{script} eq 'ir.pl' " + # to the above if-statement + if (!$form->{deliverydate}) { $transdate = $form->{invdate}; } else { $transdate = $form->{deliverydate}; @@ -1497,6 +1511,8 @@ sub retrieve_accounts { # if credit_note has a deliverydate, use this instead of invdate # useful for credit_notes of invoices from an old period with different tax # if there is no deliverydate then invdate is used, old default (see next elsif) + # Falls hier der Stichtag für Steuern anders bestimmt wird, + # entsprechend auch bei Taxkeys.pm anpassen $transdate = $form->{deliverydate}; } elsif (($form->{type} eq "credit_note") || ($form->{script} eq 'ir.pl')) { $transdate = $form->{invdate}; @@ -1616,8 +1632,8 @@ sub prepare_parts_for_printing { my $self = shift; my %params = @_; - my $myconfig = \%main::myconfig; - my $form = $main::form; + my $myconfig = $params{myconfig} || \%main::myconfig; + my $form = $params{form} || $main::form; my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);