View | Details | Raw Unified | Return to bug 35114
Collapse All | Expand All

(-)a/acqui/basket.pl (-13 / +19 lines)
Lines 341-356 if ( $op eq 'list' ) { Link Here
341
        push @books_loop, $line;
341
        push @books_loop, $line;
342
342
343
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
343
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
344
        $foot{$$line{tax_rate}}{tax_value} += get_rounded_price($$line{tax_value});
344
        $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
345
        $total_tax_value += $$line{tax_value};
345
        $total_tax_value += $$line{tax_value};
346
        $foot{$$line{tax_rate}}{quantity}  += get_rounded_price($$line{quantity});
346
        $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
347
        $total_quantity += $$line{quantity};
347
        $total_quantity += $$line{quantity};
348
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
348
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{sum_total_tax_excluded};
349
        $total_tax_excluded += $$line{total_tax_excluded};
349
        $total_tax_excluded += $$line{sum_total_tax_excluded};
350
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
350
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{sum_total_tax_included};
351
        $total_tax_included += $$line{total_tax_included};
351
        $total_tax_included += $$line{sum_total_tax_included};
352
    }
352
    }
353
353
354
    foreach my $tax_rate (keys %foot) {
355
        $foot{$tax_rate}{total_tax_excluded} = get_rounded_price($foot{$tax_rate}{total_tax_excluded});
356
        $foot{$tax_rate}{total_tax_included} = get_rounded_price($foot{$tax_rate}{total_tax_included});
357
    }
358
359
354
    push @book_foot_loop, map {$_} values %foot;
360
    push @book_foot_loop, map {$_} values %foot;
355
361
356
    # Get cancelled orders
362
    # Get cancelled orders
Lines 408-416 if ( $op eq 'list' ) { Link Here
408
        book_foot_loop       => \@book_foot_loop,
414
        book_foot_loop       => \@book_foot_loop,
409
        cancelledorders_loop => \@cancelledorders_loop,
415
        cancelledorders_loop => \@cancelledorders_loop,
410
        total_quantity       => $total_quantity,
416
        total_quantity       => $total_quantity,
411
        total_tax_excluded   => $total_tax_excluded,
417
        total_tax_excluded   => get_rounded_price($total_tax_excluded),
412
        total_tax_included   => $total_tax_included,
418
        total_tax_included   => get_rounded_price($total_tax_included),
413
        total_tax_value      => $total_tax_value,
419
        total_tax_value      => get_rounded_price($total_tax_value),
414
        currency             => $active_currency->currency,
420
        currency             => $active_currency->currency,
415
        listincgst           => $bookseller->listincgst,
421
        listincgst           => $bookseller->listincgst,
416
        basketgroups         => $basketgroups,
422
        basketgroups         => $basketgroups,
Lines 454-463 sub get_order_infos { Link Here
454
    # If we have an actual cost that should be the total, otherwise use the ecost
460
    # If we have an actual cost that should be the total, otherwise use the ecost
455
    $line{unitprice_tax_included} += 0;
461
    $line{unitprice_tax_included} += 0;
456
    $line{unitprice_tax_excluded} += 0;
462
    $line{unitprice_tax_excluded} += 0;
457
    my $cost_tax_included = $line{unitprice_tax_included} || $line{ecost_tax_included};
463
    $line{total_tax_included} = get_rounded_price($line{ecost_tax_included} * $line{quantity});
458
    my $cost_tax_excluded = $line{unitprice_tax_excluded} || $line{ecost_tax_excluded};
464
    $line{total_tax_excluded} = get_rounded_price($line{ecost_tax_excluded} * $line{quantity});
459
    $line{total_tax_included} = get_rounded_price($cost_tax_included) * $line{quantity};
465
    $line{sum_total_tax_included} = $line{ecost_tax_included} * $line{quantity};
460
    $line{total_tax_excluded} = get_rounded_price($cost_tax_excluded) * $line{quantity};
466
    $line{sum_total_tax_excluded} = $line{ecost_tax_excluded} * $line{quantity};
461
    $line{tax_value} = $line{tax_value_on_ordering};
467
    $line{tax_value} = $line{tax_value_on_ordering};
462
    $line{tax_rate} = $line{tax_rate_on_ordering};
468
    $line{tax_rate} = $line{tax_rate_on_ordering};
463
469
(-)a/acqui/basketgroup.pl (-4 / +4 lines)
Lines 75-88 sub BasketTotal { Link Here
75
    my $total = 0;
75
    my $total = 0;
76
    my @orders = GetOrders($basketno);
76
    my @orders = GetOrders($basketno);
77
    for my $order (@orders){
77
    for my $order (@orders){
78
        # FIXME The following is wrong
78
        # FIXME The following is wrong <- still true ? remove if patch 35114 fixed it
79
        if ( $bookseller->listincgst ) {
79
        if ( $bookseller->listincgst ) {
80
            $total = $total + ( get_rounded_price($order->{ecost_tax_included}) * $order->{quantity} );
80
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
81
        } else {
81
        } else {
82
            $total = $total + ( get_rounded_price($order->{ecost_tax_excluded}) * $order->{quantity} );
82
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
83
        }
83
        }
84
    }
84
    }
85
    return $total;
85
    return get_rounded_price($total);
86
}
86
}
87
87
88
#displays all basketgroups and all closed baskets (in their respective groups)
88
#displays all basketgroups and all closed baskets (in their respective groups)
(-)a/koha-tmpl/intranet-tmpl/prog/js/acq.js (-2 / +1 lines)
Lines 190-196 function updateCosts(){ Link Here
190
    var rep   = new Number(listprice*exchangerate);
190
    var rep   = new Number(listprice*exchangerate);
191
    var ecost = rrp;
191
    var ecost = rrp;
192
    if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
192
    if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
193
        ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
193
        ecost = new Number(Math.round(rrp * (100 - discount )) / 100);
194
    }
194
    }
195
    var total =  new Number( ecost * quantity);
195
    var total =  new Number( ecost * quantity);
196
    $("#rrp").val(rrp.toFixed(2));
196
    $("#rrp").val(rrp.toFixed(2));
197
- 

Return to bug 35114