Bug 19296: Allow all tax processing to happen in C4::Acquisition::populate_order_with...
authorNick Clemens <nick@bywatersolutions.com>
Tue, 12 Sep 2017 16:57:47 +0000 (16:57 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 18 Oct 2017 14:21:25 +0000 (11:21 -0300)
To test:
 1 - Create an order file that includes prices and items
(MarcFieldsToOrder)
 2 - Stage the file
 3 - Set vendor to 'prices exclude tax'
 4 - Open a basket and add from the file
 5 - View the items in the basket
 6 - Prices are reduced by the tax rate and tax is calculated to return
prices to the value in the file
 7 - Apply patch
 8 - Repeat steps 1-6
 9 - Prices should now calculate correctly
10 - Repeat with 'MarcItemFieldsToOrder'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

acqui/addorderiso2709.pl

index de6581a..0e0793b 100755 (executable)
@@ -270,22 +270,12 @@ if ($op eq ""){
                         $orderinfo{tax_rate} = $bookseller->tax_rate;
                         my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
                         $orderinfo{discount} = $c;
-                        if ( $bookseller->listincgst ) {
-                            if ( $c_discount ) {
-                                $orderinfo{ecost} = $price;
-                                $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
-                            } else {
-                                $orderinfo{ecost} = $price * ( 1 - $c );
-                                $orderinfo{rrp}   = $price;
-                            }
+                        if ( $c_discount ) {
+                            $orderinfo{ecost} = $price;
+                            $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
                         } else {
-                            if ( $c_discount ) {
-                                $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
-                                $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
-                            } else {
-                                $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
-                                $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
-                            }
+                            $orderinfo{ecost} = $price * ( 1 - $c );
+                            $orderinfo{rrp}   = $price;
                         }
                         $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
                         $orderinfo{unitprice} = $orderinfo{ecost};
@@ -340,22 +330,12 @@ if ($op eq ""){
                 $orderinfo{tax_rate} = $bookseller->tax_rate;
                 my $c = $c_discount ? $c_discount : $bookseller->discount / 100;
                 $orderinfo{discount} = $c;
-                if ( $bookseller->listincgst ) {
-                    if ( $c_discount ) {
-                        $orderinfo{ecost} = $price;
-                        $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
-                    } else {
-                        $orderinfo{ecost} = $price * ( 1 - $c );
-                        $orderinfo{rrp}   = $price;
-                    }
+                if ( $c_discount ) {
+                    $orderinfo{ecost} = $price;
+                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
                 } else {
-                    if ( $c_discount ) {
-                        $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
-                        $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
-                    } else {
-                        $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
-                        $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
-                    }
+                    $orderinfo{ecost} = $price * ( 1 - $c );
+                    $orderinfo{rrp}   = $price;
                 }
                 $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate;
                 $orderinfo{unitprice} = $orderinfo{ecost};