Merge branch 'master' of https://github.com/kivitendo/kivitendo-erp
authorAndreas Rudin <andreas.rudin@revamp-it.ch>
Thu, 30 Jun 2016 17:47:21 +0000 (19:47 +0200)
committerAndreas Rudin <andreas.rudin@revamp-it.ch>
Thu, 30 Jun 2016 17:47:21 +0000 (19:47 +0200)
SL/DB/Helper/PriceTaxCalculator.pm
SL/DB/Invoice.pm
locale/de/all
locale/en/all
templates/webpages/admin/create_dataset.html

index 44c6511..6afb45a 100644 (file)
@@ -57,7 +57,7 @@ sub calculate_prices_and_taxes {
 
   return $self unless wantarray;
 
-  return map { ($_ => $data{$_}) } qw(taxes amounts amounts_cogs allocated exchangerate assembly_items items);
+  return map { ($_ => $data{$_}) } qw(taxes amounts amounts_cogs allocated exchangerate assembly_items items rounding);
 }
 
 sub _get_exchangerate {
@@ -185,10 +185,13 @@ sub _calculate_amounts {
   _dbg("Sna " . $self->netamount . " idiff " . $data->{invoicediff} . " tdiff ${tax_diff}");
 
   my $tax              = sum values %{ $data->{taxes} };
-  $data->{arap_amount} = $netamount + $tax;
+  $amount              = $netamount + $tax;
+  my $grossamount      = _round($amount, 2, 1);
+  $data->{rounding}    = _round($grossamount - $amount, 2);
+  $data->{arap_amount} = $grossamount;
 
   $self->netamount(    $netamount);
-  $self->amount(       $netamount + $tax);
+  $self->amount(       $grossamount);
   $self->marge_percent($self->netamount ? ($self->netamount - $data->{lastcost_total}) * 100 / $self->netamount : 0);
 }
 
index 0ef5b66..99c2e11 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,12 @@ 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);
+    $self->_post_book_rounding($data{rounding});
   };
 
   if ($self->db->in_transaction) {
index b2bd702..a8907f0 100755 (executable)
@@ -2073,6 +2073,7 @@ $self->{texts} = {
   'Pre-defined Texts'           => 'Vordefinierte Textblöcke',
   'Preamble'                    => 'Einleitung',
   'Precision'                   => 'Genauigkeit',
+  'Precision Note'              => '<b>Achtung:</b> Bei Genauigkeit 0.05 dürfen Verkaufsbelege aktuell nur in Standardwährung erstellt werden.',
   'Preferences'                 => 'Einstellungen',
   'Preferences saved!'          => 'Einstellungen gespeichert!',
   'Prefix for the new bins\' names' => 'Namenspr&auml;fix f&uuml;r die neuen Lagerpl&auml;tze',
index a37b368..f7e90a8 100644 (file)
@@ -1628,6 +1628,7 @@ $self->{texts} = {
   'Postscript'                  => '',
   'Posustva_coa'                => '',
   'Precision'                   => '',
+  'Precision Note'              => '<b>Attention:</b> currently with a precision of 0.05 sales sheets have to use the default currency.',
   'Preferences'                 => '',
   'Preferences saved!'          => '',
   'Prefix for the new bins\' names' => '',
@@ -2448,7 +2449,7 @@ $self->{texts} = {
   'Updating the client fields in the database "#1" on host "#2:#3" failed.' => '',
   'Uploaded on #1, size #2 kB'  => '',
   'Use As New'                  => '',
-  'Use Income'                 => 'Use GUV and BWA',
+  'Use Income'      => 'Use GUV and BWA',
   'Use WebDAV Repository'       => '',
   'Use existing templates'      => '',
   'Use linked items'            => '',
index 49320eb..7a879d8 100644 (file)
@@ -33,7 +33,7 @@
 
   <tr>
    <th align="right" nowrap>[% LxERP.t8('Precision') %]</th>
-   <td>[% L.input_tag('precision_as_number', LxERP.format_amount(FORM.precision, 2)) %]</td>
+   <td>[% L.input_tag('precision_as_number', LxERP.format_amount(FORM.precision, 2)) %] [% LxERP.t8('Precision Note') %]</td>
   </tr>
 
   <tr>