[Koha-bugs] [Bug 19296] New: Tax is being subtracted from orders when vendor price does not include gst and ordering from a file

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Sep 12 18:16:54 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19296

            Bug ID: 19296
           Summary: Tax is being subtracted from orders when vendor price
                    does not include gst and ordering from a file
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Acquisitions
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: nick at bywatersolutions.com
        QA Contact: testopia at bugs.koha-community.org

In the case of vendor prices don't include gst we are removing the gst from the
order price, passing it to populate_order_with_prices and calculating tax on
the price with tax removed!

Example:
Order with price of $10 and tax rate of 10%
We calculate ecost/rrp at 9.09
Then calculate tax on 9.09
We should be calculating tax on $10

In addorderiso2707.pl:
270                         if ( $bookseller->listincgst ) {
271                             if ( $c_discount ) {
272                                 $orderinfo{ecost} = $price;
273                                 $orderinfo{rrp}   = $orderinfo{ecost} / ( 1
- $c );
274                             } else {
275                                 $orderinfo{ecost} = $price * ( 1 - $c );
276                                 $orderinfo{rrp}   = $price;
277                             }
278                         } else {
279                             if ( $c_discount ) {
280                                 $orderinfo{ecost} = $price / ( 1 +
$orderinfo{tax_rate} );
281                                 $orderinfo{rrp}   = $orderinfo{ecost} / ( 1
- $c );
282                             } else {
283                                 $orderinfo{rrp}   = $price / ( 1 +
$orderinfo{tax_rate} );
284                                 $orderinfo{ecost} = $orderinfo{rrp} * ( 1 -
$c );
285                             }
286                         }
...
296 
297                     %orderinfo = %{
298                         C4::Acquisition::populate_order_with_prices(
299                             {
300                                 order        => \%orderinfo,
301                                 booksellerid => $booksellerid,
302                                 ordering     => 1,
303                                 receiving    => 1,
304                             }
305                         )
306                     };

Then in C4 Acquisition:

2943     if ($ordering) {
2944         $order->{tax_rate_on_ordering} //= $order->{tax_rate};
2945         if ( $bookseller->listincgst ) {
2946             # The user entered the rrp tax included
2947             $order->{rrp_tax_included} = $order->{rrp};
2948 
2949             # rrp tax excluded = rrp tax included / ( 1 + tax rate )
2950             $order->{rrp_tax_excluded} = $order->{rrp_tax_included} / ( 1
+ $order->{tax_rate_on_ordering} );
2951 
2952             # ecost tax excluded = rrp tax excluded * ( 1 - discount )
2953             $order->{ecost_tax_excluded} = $order->{rrp_tax_excluded} * (
1 - $discount );
2954 
2955             # ecost tax included = rrp tax included  ( 1 - discount )
2956             $order->{ecost_tax_included} = $order->{rrp_tax_included} * (
1 - $discount );
2957         }
2958         else {
2959             # The user entered the rrp tax excluded
2960             $order->{rrp_tax_excluded} = $order->{rrp};
2961 
2962             # rrp tax included = rrp tax excluded * ( 1 - tax rate )
2963             $order->{rrp_tax_included} = $order->{rrp_tax_excluded} * ( 1
+ $order->{tax_rate_on_ordering} );
2964 
2965             # ecost tax excluded = rrp tax excluded * ( 1 - discount )
2966             $order->{ecost_tax_excluded} = $order->{rrp_tax_excluded} * (
1 - $discount );
2967 
2968             # ecost tax included = rrp tax excluded * ( 1 - tax rate ) * (
1 - discount )
2969             $order->{ecost_tax_included} =
2970                 $order->{rrp_tax_excluded} *
2971                 ( 1 + $order->{tax_rate_on_ordering} ) *
2972                 ( 1 - $discount );
2973         }
2974 
2975         # tax value = quantity * ecost tax excluded * tax rate
2976         $order->{tax_value_on_ordering} =
2977             $order->{quantity} * $order->{ecost_tax_excluded} *
$order->{tax_rate_on_ordering};
2978     }

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list