X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDATEV.pm;h=dfd154236afea3d27729af5933a3235925a6a0c0;hb=f964437c368c7ebf2a11e61648ccc66d5a2743d8;hp=50fb1c7a602f456792bb25fa60b6256a6107f47f;hpb=8a40e3dd0f638557b8c666fe708ccbc1ac709c4e;p=kivitendo-erp.git diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 50fb1c7a6..dfd154236 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -1,5 +1,5 @@ #===================================================================== -# Lx-Office ERP +# kivitendo ERP # Copyright (c) 2004 # # Author: Philip Reetz @@ -193,6 +193,16 @@ sub to { return $self->{to}; } +sub trans_id { + my $self = shift; + + if (@_) { + $self->{trans_id} = $_[0]; + } + + return $self->{trans_id}; +} + sub accnofrom { my $self = shift; @@ -342,6 +352,10 @@ sub _get_transactions { my $form = $main::form; + my $trans_id_filter = ''; + + $trans_id_filter = 'AND ac.trans_id = ' . $self->trans_id if $self->trans_id; + my ($notsplitindex); $fromto =~ s/transdate/ac\.transdate/g; @@ -353,9 +367,9 @@ sub _get_transactions { my $query = qq|SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,ar.id, ac.amount, ac.taxkey, - ar.invnumber, ar.duedate, ar.amount as umsatz, + ar.invnumber, ar.duedate, ar.amount as umsatz, ar.deliverydate, ct.name, - c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, c.link, + c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ar.invoice FROM acc_trans ac LEFT JOIN ar ON (ac.trans_id = ar.id) @@ -363,14 +377,15 @@ sub _get_transactions { LEFT JOIN chart c ON (ac.chart_id = c.id) WHERE (ar.id IS NOT NULL) AND $fromto + $trans_id_filter $filter UNION ALL SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,ap.id, ac.amount, ac.taxkey, - ap.invnumber, ap.duedate, ap.amount as umsatz, + ap.invnumber, ap.duedate, ap.amount as umsatz, ap.deliverydate, ct.name, - c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, c.link, + c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ap.invoice FROM acc_trans ac LEFT JOIN ap ON (ac.trans_id = ap.id) @@ -378,20 +393,22 @@ sub _get_transactions { LEFT JOIN chart c ON (ac.chart_id = c.id) WHERE (ap.id IS NOT NULL) AND $fromto + $trans_id_filter $filter UNION ALL SELECT ac.acc_trans_id, ac.transdate, ac.trans_id,gl.id, ac.amount, ac.taxkey, - gl.reference AS invnumber, gl.transdate AS duedate, ac.amount as umsatz, + gl.reference AS invnumber, gl.transdate AS duedate, ac.amount as umsatz, NULL as deliverydate, gl.description AS name, - c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, c.link, + c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, FALSE AS invoice FROM acc_trans ac LEFT JOIN gl ON (ac.trans_id = gl.id) LEFT JOIN chart c ON (ac.chart_id = c.id) WHERE (gl.id IS NOT NULL) AND $fromto + $trans_id_filter $filter ORDER BY trans_id, acc_trans_id|; @@ -465,11 +482,11 @@ sub _get_transactions { next; } - # determine at which array position the reference value (called absumsatz) is + # determine at which array position the reference value (called absumsatz) is # and which amount it has for my $j (0 .. (scalar(@{$trans}) - 1)) { - + # Three cases: # 1: gl transaction (Dialogbuchung), invoice is false, no double split booking allowed @@ -528,7 +545,8 @@ sub _get_transactions { push @{ $self->{DATEV} }, [ \%new_trans, $trans->[$j] ]; } elsif (($j != $notsplitindex) && !$trans->[$j]->{is_tax}) { - my %tax_info = $taxkeys->get_full_tax_info('transdate' => $trans->[$j]->{transdate}); + my %tax_info = $taxkeys->get_full_tax_info('transdate' => $trans->[$j]->{transdate}, + 'deliverydate' => $trans->[$j]->{deliverydate}); my %new_trans = (); map { $new_trans{$_} = $trans->[$notsplitindex]->{$_}; } keys %{ $trans->[$notsplitindex] }; @@ -1037,7 +1055,7 @@ __END__ =head1 NAME -SL::DATEV - Lx-Office DATEV Export module +SL::DATEV - kivitendo DATEV Export module =head1 SYNOPSIS