From: Andreas Rudin Date: Thu, 30 Jun 2016 17:47:21 +0000 (+0200) Subject: Merge branch 'master' of https://github.com/kivitendo/kivitendo-erp X-Git-Tag: release-3.4.1~11 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/737b3bdd3f0f38849d51162dc6f307a0d4a8da71?hp=d2f731cac86e4590b46e990caf7bb5f7f717ccb6 Merge branch 'master' of https://github.com/kivitendo/kivitendo-erp --- diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index 44c651196..6afb45a4f 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -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); } diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 0ef5b6602..99c2e11ad 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,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) { diff --git a/locale/de/all b/locale/de/all index b2bd7023e..a8907f0a8 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2073,6 +2073,7 @@ $self->{texts} = { 'Pre-defined Texts' => 'Vordefinierte Textblöcke', 'Preamble' => 'Einleitung', 'Precision' => 'Genauigkeit', + 'Precision Note' => 'Achtung: 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äfix für die neuen Lagerplätze', diff --git a/locale/en/all b/locale/en/all index a37b3686c..f7e90a82f 100644 --- a/locale/en/all +++ b/locale/en/all @@ -1628,6 +1628,7 @@ $self->{texts} = { 'Postscript' => '', 'Posustva_coa' => '', 'Precision' => '', + 'Precision Note' => 'Attention: 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' => '', diff --git a/templates/webpages/admin/create_dataset.html b/templates/webpages/admin/create_dataset.html index 49320eb6b..7a879d8aa 100644 --- a/templates/webpages/admin/create_dataset.html +++ b/templates/webpages/admin/create_dataset.html @@ -33,7 +33,7 @@ [% LxERP.t8('Precision') %] - [% L.input_tag('precision_as_number', LxERP.format_amount(FORM.precision, 2)) %] + [% L.input_tag('precision_as_number', LxERP.format_amount(FORM.precision, 2)) %] [% LxERP.t8('Precision Note') %]