From 04caff2d7309da75f53424675795addff173f32c Mon Sep 17 00:00:00 2001 From: Rolf Fluehmann Date: Thu, 30 Jun 2016 18:40:58 +0200 Subject: [PATCH] Revert "added roundings for periodic invoices" This reverts commit 64b3d19a8012187c3c01717b91d59df2b2753ee3. --- SL/DB/Invoice.pm | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 0ef5b6602..9aa17adec 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -249,12 +249,6 @@ sub post { my $worker = sub { my %data = $self->calculate_prices_and_taxes; - my $grossamount = $self->amount; - $self->amount($::form->round_amount($grossamount, 2, 1)); - my $rounding = $::form->round_amount( - $self->amount - $grossamount, - 2 - ); $self->_post_create_assemblyitem_entries($data{assembly_items}); $self->save; @@ -262,11 +256,10 @@ sub post { $self->_post_add_acctrans($data{amounts_cogs}); $self->_post_add_acctrans($data{amounts}); $self->_post_add_acctrans($data{taxes}); + $self->_post_add_acctrans({ $params{ar_id} => $self->amount * -1 }); $self->_post_update_allocated($data{allocated}); - - $self->_post_book_rounding($rounding); }; if ($self->db->in_transaction) { @@ -303,26 +296,6 @@ sub _post_add_acctrans { } } -sub _post_book_rounding { - my ($self, $rounding) = @_; - - my $tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id; - my $rnd_accno = $rounding == 0 ? 0 - : $rounding > 0 ? SL::DB::Default->get->rndgain_accno_id - : SL::DB::Default->get->rndloss_accno_id - ; - if ($rnd_accno != 0) { - SL::DB::AccTransaction->new(trans_id => $self->id, - chart_id => $rnd_accno, - amount => $rounding, - tax_id => $tax_id, - taxkey => 0, - project_id => $self->globalproject_id, - transdate => $self->transdate, - chart_link => $rnd_accno)->save; - } -} - sub add_ar_amount_row { my ($self, %params ) = @_; -- 2.20.1