Revert "added roundings for periodic invoices"
authorRolf Fluehmann <rolf.fluehmann@revamp-it.ch>
Thu, 30 Jun 2016 16:40:58 +0000 (18:40 +0200)
committerRolf Fluehmann <rolf.fluehmann@revamp-it.ch>
Thu, 30 Jun 2016 16:40:58 +0000 (18:40 +0200)
This reverts commit 64b3d19a8012187c3c01717b91d59df2b2753ee3.

SL/DB/Invoice.pm

index 0ef5b66..9aa17ad 100644 (file)
@@ -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 ) = @_;