X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FGoBD.pm;h=2992b5f4edd3cee4bd8a905ac4d33fd121bfaddb;hb=9e3dbc2a089a0206df834496c158ced368a459d8;hp=40998a2ded66f8156c75a89a891a6ee5013795b6;hpb=a832d0e55330a501f2a4627ef736dc172a3bb212;p=kivitendo-erp.git diff --git a/SL/GoBD.pm b/SL/GoBD.pm index 40998a2de..2992b5f4e 100644 --- a/SL/GoBD.pm +++ b/SL/GoBD.pm @@ -90,6 +90,7 @@ my %datev_column_defs = ( customer_id => { type => 'Rose::DB::Object::Metadata::Column::Integer', text => t8('Customer (database ID)'), }, vendor_id => { type => 'Rose::DB::Object::Metadata::Column::Integer', text => t8('Vendor (database ID)'), }, itime => { type => 'Rose::DB::Object::Metadata::Column::Date', text => t8('Create Date'), }, + gldate => { type => 'Rose::DB::Object::Metadata::Column::Date', text => t8('Booking Date'), }, ); my @datev_columns = qw( @@ -101,7 +102,7 @@ my @datev_columns = qw( credit_accno credit_accname credit_amount credit_tax taxdescription tax tax_accno tax_accname taxkey - notes itime + notes itime gldate ); # rows in this listing are tiers. @@ -418,6 +419,10 @@ sub do_datev_csv_export { $datev->_get_transactions(from_to => $datev->fromto); + if ($datev->errors) { + die [ $datev->errors ]; + } + for my $transaction (@{ $datev->{DATEV} }) { for my $entry (@{ $transaction }) { $entry->{sortkey} = join '-', map { lc } (DateTime->from_kivitendo($entry->{transdate})->strftime('%Y%m%d'), $entry->{name}, $entry->{reference}); @@ -448,27 +453,24 @@ sub do_datev_csv_export { $haben->{notes} //= ''; $haben->{notes} = SL::HTML::Util->strip($haben->{notes}); - my $net_amount = defined $amount->{net_amount} - ? $::form->format_amount($myconfig, abs($amount->{net_amount}), 5) - : 0; - my $tax_amount = defined $amount->{net_amount} - ? $::form->format_amount($myconfig, abs($amount->{amount}) - abs($amount->{net_amount}), 5) - : 0; + my $tax_amount = defined $amount->{net_amount} ? abs($amount->{amount}) - abs($amount->{net_amount}) : 0; + + $tax = {} if abs($tax_amount) < 0.001; my %row = ( amount => $::form->format_amount($myconfig, abs($amount->{amount}),5), debit_accno => $soll->{accno}, debit_accname => $soll->{accname}, - debit_amount => -$soll->{amount}, - debit_tax => $soll->{tax_accno} ? $tax_amount : 0, + debit_amount => $::form->format_amount($myconfig, abs(-$soll->{amount}),5), + debit_tax => $soll->{tax_accno} ? $::form->format_amount($myconfig, $tax_amount, 5) : 0, credit_accno => $haben->{accno}, credit_accname => $haben->{accname}, - credit_amount => $haben->{amount}, - credit_tax => $haben->{tax_accno} ? $tax_amount : 0, - tax => $tax_amount, + credit_amount => $::form->format_amount($myconfig, abs($haben->{amount}),5),, + credit_tax => $haben->{tax_accno} ? $::form->format_amount($myconfig, $tax_amount, 5) : 0, + tax => $::form->format_amount($myconfig, $tax_amount, 5), notes => $haben->{notes}, (map { ($_ => $tax->{$_}) } qw(taxkey tax_accname tax_accno taxdescription)), - (map { ($_ => ($haben->{$_} // $soll->{$_})) } qw(trans_id invnumber name vcnumber transdate itime customer_id vendor_id)), + (map { ($_ => ($haben->{$_} // $soll->{$_})) } qw(trans_id invnumber name vcnumber transdate gldate itime customer_id vendor_id)), ); # if ($row{debit_amount} + $row{debit_tax} - ($row{credit_amount} + $row{credit_tax}) > 0.005) {