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

(-)a/acqui/basket.pl (-28 / +6 lines)
Lines 334-340 if ( $op eq 'delete_confirm' ) { Link Here
334
    my $cur = GetCurrency();
334
    my $cur = GetCurrency();
335
335
336
336
337
    my @results = GetOrders( $basketno );
337
    my @orders = GetOrders( $basketno );
338
    my @books_loop;
338
    my @books_loop;
339
339
340
    my @book_foot_loop;
340
    my @book_foot_loop;
Lines 343-349 if ( $op eq 'delete_confirm' ) { Link Here
343
    my $total_gste = 0;
343
    my $total_gste = 0;
344
    my $total_gsti = 0;
344
    my $total_gsti = 0;
345
    my $total_gstvalue = 0;
345
    my $total_gstvalue = 0;
346
    for my $order (@results) {
346
    for my $order (@orders) {
347
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
347
        my $line = get_order_infos( $order, $bookseller);
348
        my $line = get_order_infos( $order, $bookseller);
348
        if ( $line->{uncertainprice} ) {
349
        if ( $line->{uncertainprice} ) {
349
            $template->param( uncertainprices => 1 );
350
            $template->param( uncertainprices => 1 );
Lines 351-357 if ( $op eq 'delete_confirm' ) { Link Here
351
352
352
        push @books_loop, $line;
353
        push @books_loop, $line;
353
354
354
        $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
355
        $foot{$$line{gstgsti}}{gstrate} = $$line{gstrate};
355
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
356
        $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
356
        $total_gstvalue += $$line{gstvalue};
357
        $total_gstvalue += $$line{gstvalue};
357
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
358
        $foot{$$line{gstgsti}}{quantity}  += $$line{quantity};
Lines 365-373 if ( $op eq 'delete_confirm' ) { Link Here
365
    push @book_foot_loop, map {$_} values %foot;
366
    push @book_foot_loop, map {$_} values %foot;
366
367
367
    # Get cancelled orders
368
    # Get cancelled orders
368
    @results = GetCancelledOrders($basketno);
369
    my @cancelledorders = GetCancelledOrders($basketno);
369
    my @cancelledorders_loop;
370
    my @cancelledorders_loop;
370
    for my $order (@results) {
371
    for my $order (@cancelledorders) {
371
        my $line = get_order_infos( $order, $bookseller);
372
        my $line = get_order_infos( $order, $bookseller);
372
        push @cancelledorders_loop, $line;
373
        push @cancelledorders_loop, $line;
373
    }
374
    }
Lines 375-381 if ( $op eq 'delete_confirm' ) { Link Here
375
    my $contract = GetContract({
376
    my $contract = GetContract({
376
        contractnumber => $basket->{contractnumber}
377
        contractnumber => $basket->{contractnumber}
377
    });
378
    });
378
    my @orders = GetOrders($basketno);
379
379
380
    if ($basket->{basketgroupid}){
380
    if ($basket->{basketgroupid}){
381
        $basketgroup = GetBasketgroup($basket->{basketgroupid});
381
        $basketgroup = GetBasketgroup($basket->{basketgroupid});
Lines 446-473 sub get_order_infos { Link Here
446
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
446
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
447
    $line{basketno}       = $basketno;
447
    $line{basketno}       = $basketno;
448
    $line{budget_name}    = $budget->{budget_name};
448
    $line{budget_name}    = $budget->{budget_name};
449
    $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
450
    if ( $bookseller->{'listincgst'} ) {
451
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
452
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
453
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
454
        $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
455
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
456
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
457
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
458
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
459
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
460
    } else {
461
        $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
462
        $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
463
        $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
464
        $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
465
        $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
466
        $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
467
        $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
468
        $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
469
        $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
470
    }
471
449
472
    if ( $line{uncertainprice} ) {
450
    if ( $line{uncertainprice} ) {
473
        $line{rrpgste} .= ' (Uncertain)';
451
        $line{rrpgste} .= ' (Uncertain)';
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-11 / +11 lines)
Lines 1-4 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Price %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
4
<title>Koha &rsaquo; Acquisitions &rsaquo; [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
Lines 415-421 Link Here
415
                [% FOREACH foot_loo IN book_foot_loop %]
416
                [% FOREACH foot_loo IN book_foot_loop %]
416
                    <tr>
417
                    <tr>
417
                        <th></th>
418
                        <th></th>
418
                        <th>Total (GST [% foot_loo.gstgsti %])</th>
419
                        <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
419
                        <th class="gste">&nbsp;</th>
420
                        <th class="gste">&nbsp;</th>
420
                        <th class="gste">&nbsp;</th>
421
                        <th class="gste">&nbsp;</th>
421
                        <th class="gsti">&nbsp;</th>
422
                        <th class="gsti">&nbsp;</th>
Lines 502-516 Link Here
502
                        </td>
503
                        </td>
503
                        [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
504
                        [% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
504
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
505
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
505
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste %]</td>
506
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
506
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste %]</td>
507
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
507
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti %]</td>
508
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
508
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti %]</td>
509
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
509
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
510
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
510
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste %]</td>
511
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
511
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti %]</td>
512
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
512
                        <td class="number [% IF books_loo.gstgsti.search(zero_regex) %]error[% END %]">[% books_loo.gstgsti %]</td>
513
                        <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
513
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue %]</td>
514
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
514
                        <td>[% books_loo.budget_name %]</td>
515
                        <td>[% books_loo.budget_name %]</td>
515
                        [% IF ( active ) %]
516
                        [% IF ( active ) %]
516
                            [% UNLESS ( closedate ) %]
517
                            [% UNLESS ( closedate ) %]
Lines 620-626 Link Here
620
                    <td class="number">[% order.quantity %]</td>
621
                    <td class="number">[% order.quantity %]</td>
621
                    <td class="number gste">[% order.totalgste %]</td>
622
                    <td class="number gste">[% order.totalgste %]</td>
622
                    <td class="number gsti">[% order.totalgsti %]</td>
623
                    <td class="number gsti">[% order.totalgsti %]</td>
623
                    <td class="number">[% order.gstgsti %]</td>
624
                    <td class="number">[% order.gstrate * 100 %]</td>
624
                    <td class="number">[% order.gstvalue %]</td>
625
                    <td class="number">[% order.gstvalue %]</td>
625
                    <td>[% order.budget_name %]
626
                    <td>[% order.budget_name %]
626
                  </tr>
627
                  </tr>
627
- 

Return to bug 12970