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

(-)a/C4/Acquisition.pm (-105 / +101 lines)
Lines 1354-1405 sub GetCancelledOrders { Link Here
1354
1354
1355
=head3 ModReceiveOrder
1355
=head3 ModReceiveOrder
1356
1356
1357
  &ModReceiveOrder({
1357
    my ( $date_received, $new_ordernumber ) = ModReceiveOrder(
1358
    biblionumber => $biblionumber,
1358
        {
1359
    ordernumber => $ordernumber,
1359
            biblionumber         => $biblionumber,
1360
    quantityreceived => $quantityreceived,
1360
            order                => $order,
1361
    user => $user,
1361
            quantityreceived     => $quantityreceived,
1362
    cost => $cost,
1362
            user                 => $user,
1363
    ecost => $ecost,
1363
            invoice              => $invoice,
1364
    invoiceid => $invoiceid,
1364
            budget_id            => $budget_id,
1365
    rrp => $rrp,
1365
            received_itemnumbers => \@received_itemnumbers,
1366
    budget_id => $budget_id,
1366
            order_internalnote   => $order_internalnote,
1367
    datereceived => $datereceived,
1367
        }
1368
    received_itemnumbers => \@received_itemnumbers,
1368
    );
1369
    order_internalnote => $order_internalnote,
1370
    order_vendornote => $order_vendornote,
1371
   });
1372
1369
1373
Updates an order, to reflect the fact that it was received, at least
1370
Updates an order, to reflect the fact that it was received, at least
1374
in part. All arguments not mentioned below update the fields with the
1371
in part.
1375
same name in the aqorders table of the Koha database.
1376
1372
1377
If a partial order is received, splits the order into two.
1373
If a partial order is received, splits the order into two.
1378
1374
1379
Updates the order with bibilionumber C<$biblionumber> and ordernumber
1375
Updates the order with biblionumber C<$biblionumber> and ordernumber
1380
C<$ordernumber>.
1376
C<$order->{ordernumber}>.
1381
1377
1382
=cut
1378
=cut
1383
1379
1384
1380
1385
sub ModReceiveOrder {
1381
sub ModReceiveOrder {
1386
    my ( $params ) = @_;
1382
    my ($params)       = @_;
1387
    my $biblionumber = $params->{biblionumber};
1383
    my $biblionumber   = $params->{biblionumber};
1388
    my $ordernumber = $params->{ordernumber};
1384
    my $order          = { %{ $params->{order} } }; # Copy the order, we don't want to modify it
1389
    my $quantrec = $params->{quantityreceived};
1385
    my $invoice        = $params->{invoice};
1390
    my $user = $params->{user};
1386
    my $quantrec       = $params->{quantityreceived};
1391
    my $cost = $params->{cost};
1387
    my $user           = $params->{user};
1392
    my $ecost = $params->{ecost};
1388
    my $budget_id      = $params->{budget_id};
1393
    my $invoiceid = $params->{invoiceid};
1394
    my $rrp = $params->{rrp};
1395
    my $budget_id = $params->{budget_id};
1396
    my $datereceived = $params->{datereceived};
1397
    my $received_items = $params->{received_items};
1389
    my $received_items = $params->{received_items};
1398
    my $order_internalnote = $params->{order_internalnote};
1399
    my $order_vendornote = $params->{order_vendornote};
1400
1390
1401
    my $dbh = C4::Context->dbh;
1391
    my $dbh = C4::Context->dbh;
1402
    $datereceived = C4::Dates->output('iso') unless $datereceived;
1392
    my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string;
1403
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1393
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1404
    if ($suggestionid) {
1394
    if ($suggestionid) {
1405
        ModSuggestion( {suggestionid=>$suggestionid,
1395
        ModSuggestion( {suggestionid=>$suggestionid,
Lines 1408-1422 sub ModReceiveOrder { Link Here
1408
                        );
1398
                        );
1409
    }
1399
    }
1410
1400
1411
    my $result_set = $dbh->selectall_arrayref(
1401
    my $new_ordernumber = $order->{ordernumber};
1412
q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?},
1413
        { Slice => {} }, $biblionumber, $ordernumber
1414
    );
1415
1416
    # we assume we have a unique order
1417
    my $order = $result_set->[0];
1418
1419
    my $new_ordernumber = $ordernumber;
1420
    if ( $order->{quantity} > $quantrec ) {
1402
    if ( $order->{quantity} > $quantrec ) {
1421
        # Split order line in two parts: the first is the original order line
1403
        # Split order line in two parts: the first is the original order line
1422
        # without received items (the quantity is decreased),
1404
        # without received items (the quantity is decreased),
Lines 1426-1453 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1426
            UPDATE aqorders
1408
            UPDATE aqorders
1427
            SET quantity = ?,
1409
            SET quantity = ?,
1428
                orderstatus = 'partial'|;
1410
                orderstatus = 'partial'|;
1429
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1411
        $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote};
1430
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1431
        $query .= q| WHERE ordernumber = ?|;
1412
        $query .= q| WHERE ordernumber = ?|;
1432
        my $sth = $dbh->prepare($query);
1413
        my $sth = $dbh->prepare($query);
1433
1414
1434
        $sth->execute(
1415
        $sth->execute(
1435
            $order->{quantity} - $quantrec,
1416
            $order->{quantity} - $quantrec,
1436
            ( defined $order_internalnote ? $order_internalnote : () ),
1417
            ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ),
1437
            ( defined $order_vendornote ? $order_vendornote : () ),
1418
            $order->{ordernumber}
1438
            $ordernumber
1439
        );
1419
        );
1440
1420
1441
        delete $order->{'ordernumber'};
1421
        delete $order->{ordernumber};
1442
        $order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} );
1422
        $order->{budget_id} = ( $budget_id || $order->{budget_id} );
1443
        $order->{'quantity'} = $quantrec;
1423
        $order->{quantity} = $quantrec;
1444
        $order->{'quantityreceived'} = $quantrec;
1424
        $order->{quantityreceived} = $quantrec;
1445
        $order->{'datereceived'} = $datereceived;
1425
        $order->{datereceived} = $datereceived;
1446
        $order->{'invoiceid'} = $invoiceid;
1426
        $order->{invoiceid} = $invoice->{invoiceid};
1447
        $order->{'unitprice'} = $cost;
1427
        $order->{orderstatus} = 'complete';
1448
        $order->{'rrp'} = $rrp;
1449
        $order->{ecost} = $ecost;
1450
        $order->{'orderstatus'} = 'complete';
1451
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1428
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1452
1429
1453
        if ($received_items) {
1430
        if ($received_items) {
Lines 1457-1482 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1457
        }
1434
        }
1458
    } else {
1435
    } else {
1459
        my $query = q|
1436
        my $query = q|
1460
            update aqorders
1437
            UPDATE aqorders
1461
            set quantityreceived=?,datereceived=?,invoiceid=?,
1438
            SET quantityreceived = ?,
1462
                unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete'|;
1439
                datereceived = ?,
1463
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1440
                invoiceid = ?,
1464
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1441
                budget_id = ?,
1442
                orderstatus = 'complete'
1443
        |;
1444
1445
        $query .= q|
1446
            , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ?
1447
        | if defined $order->{unitprice};
1448
1449
        $query .= q|
1450
            , rrp = ?, rrp_tax_included = ?, rrp_tax_excluded = ?
1451
        | if defined $order->{rrp};
1452
1453
        $query .= q|
1454
            , ecost = ?, ecost_tax_included = ?, ecost_tax_excluded = ?
1455
        | if defined $order->{ecost};
1456
1457
        $query .= q|
1458
            , order_internalnote = ?
1459
        | if defined $order->{order_internalnote};
1460
1465
        $query .= q| where biblionumber=? and ordernumber=?|;
1461
        $query .= q| where biblionumber=? and ordernumber=?|;
1462
1466
        my $sth = $dbh->prepare( $query );
1463
        my $sth = $dbh->prepare( $query );
1467
        $sth->execute(
1464
        my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, $budget_id );
1468
            $quantrec,
1465
1469
            $datereceived,
1466
        if ( defined $order->{unitprice} ) {
1470
            $invoiceid,
1467
            push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded};
1471
            $cost,
1468
        }
1472
            $rrp,
1469
        if ( defined $order->{rrp} ) {
1473
            $ecost,
1470
            push @params, $order->{rrp}, $order->{rrp_tax_included}, $order->{rrp_tax_excluded};
1474
            $budget_id,
1471
        }
1475
            ( defined $order_internalnote ? $order_internalnote : () ),
1472
        if ( defined $order->{ecost} ) {
1476
            ( defined $order_vendornote ? $order_vendornote : () ),
1473
            push @params, $order->{ecost}, $order->{ecost_tax_included}, $order->{ecost_tax_excluded};
1477
            $biblionumber,
1474
        }
1478
            $ordernumber
1475
        if ( defined $order->{order_internalnote} ) {
1479
        );
1476
            push @params, $order->{order_internalnote};
1477
        }
1478
1479
        push @params, ( $biblionumber, $order->{ordernumber} );
1480
1481
        $sth->execute( @params );
1480
    }
1482
    }
1481
    return ($datereceived, $new_ordernumber);
1483
    return ($datereceived, $new_ordernumber);
1482
}
1484
}
Lines 2836-2885 sub populate_order_with_prices { Link Here
2836
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2838
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2837
    if ($ordering) {
2839
    if ($ordering) {
2838
        if ( $bookseller->{listincgst} ) {
2840
        if ( $bookseller->{listincgst} ) {
2839
            $order->{rrpgsti} = $order->{rrp};
2841
            $order->{rrp_tax_included} = $order->{rrp};
2840
            $order->{rrpgste} = Koha::Number::Price->new(
2842
            $order->{rrp_tax_excluded} = Koha::Number::Price->new(
2841
                $order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round;
2843
                $order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2842
            $order->{ecostgsti} = $order->{ecost};
2844
            $order->{ecost_tax_included} = $order->{ecost};
2843
            $order->{ecostgste} = Koha::Number::Price->new(
2845
            $order->{ecost_tax_excluded} = Koha::Number::Price->new(
2844
                $order->{ecost} / ( 1 + $order->{gstrate} ) )->round;
2846
                $order->{ecost} / ( 1 + $order->{tax_rate} ) )->round;
2845
            $order->{gstvalue} = Koha::Number::Price->new(
2847
            $order->{tax_value} = Koha::Number::Price->new(
2846
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2848
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2847
                  $order->{quantity} )->round;
2849
                  $order->{quantity} )->round;
2848
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2849
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2850
        }
2850
        }
2851
        else {
2851
        else {
2852
            $order->{rrpgste} = $order->{rrp};
2852
            $order->{rrp_tax_excluded} = $order->{rrp};
2853
            $order->{rrpgsti} = Koha::Number::Price->new(
2853
            $order->{rrp_tax_included} = Koha::Number::Price->new(
2854
                $order->{rrp} * ( 1 + $order->{gstrate} ) )->round;
2854
                $order->{rrp} * ( 1 + $order->{tax_rate} ) )->round;
2855
            $order->{ecostgste} = $order->{ecost};
2855
            $order->{ecost_tax_excluded} = $order->{ecost};
2856
            $order->{ecostgsti} = Koha::Number::Price->new(
2856
            $order->{ecost_tax_included} = Koha::Number::Price->new(
2857
                $order->{ecost} * ( 1 + $order->{gstrate} ) )->round;
2857
                $order->{ecost} * ( 1 + $order->{tax_rate} ) )->round;
2858
            $order->{gstvalue} = Koha::Number::Price->new(
2858
            $order->{tax_value} = Koha::Number::Price->new(
2859
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2859
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2860
                  $order->{quantity} )->round;
2860
                  $order->{quantity} )->round;
2861
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2862
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2863
        }
2861
        }
2864
    }
2862
    }
2865
2863
2866
    if ($receiving) {
2864
    if ($receiving) {
2867
        if ( $bookseller->{listincgst} ) {
2865
        if ( $bookseller->{listincgst} ) {
2868
            $order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round;
2866
            $order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round;
2869
            $order->{unitpricegste} = Koha::Number::Price->new(
2867
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new(
2870
              $order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round;
2868
              $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2871
        }
2869
        }
2872
        else {
2870
        else {
2873
            $order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round;
2871
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round;
2874
            $order->{unitpricegsti} = Koha::Number::Price->new(
2872
            $order->{unitprice_tax_included} = Koha::Number::Price->new(
2875
              $order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round;
2873
              $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round;
2876
        }
2874
        }
2877
        $order->{gstvalue} = Koha::Number::Price->new(
2875
        $order->{tax_value} = Koha::Number::Price->new(
2878
          ( $order->{unitpricegsti} - $order->{unitpricegste} )
2876
          ( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} )
2879
          * $order->{quantityreceived} )->round;
2877
          * $order->{quantityreceived} )->round;
2880
2878
2881
        $order->{totalgste} = $order->{unitpricegste} * $order->{quantity};
2882
        $order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity};
2883
    }
2879
    }
2884
2880
2885
    return $order;
2881
    return $order;
(-)a/C4/Bookseller.pm (-4 / +4 lines)
Lines 138-144 sub AddBookseller { Link Here
138
                name,      address1,      address2,     address3, address4,
138
                name,      address1,      address2,     address3, address4,
139
                postal,    phone,         accountnumber,fax,      url,
139
                postal,    phone,         accountnumber,fax,      url,
140
                active,    listprice,     invoiceprice, gstreg,
140
                active,    listprice,     invoiceprice, gstreg,
141
                listincgst,invoiceincgst, gstrate,      discount, notes,
141
                listincgst,invoiceincgst, tax_rate,      discount, notes,
142
                deliverytime
142
                deliverytime
143
            )
143
            )
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
Lines 153-159 sub AddBookseller { Link Here
153
        $data->{'active'},       $data->{'listprice'},
153
        $data->{'active'},       $data->{'listprice'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
156
        $data->{'gstrate'},      $data->{'discount'},
156
        $data->{'tax_rate'},      $data->{'discount'},
157
        $data->{notes},          $data->{deliverytime},
157
        $data->{notes},          $data->{deliverytime},
158
    );
158
    );
159
159
Lines 196-202 sub ModBookseller { Link Here
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
197
            active=?,listprice=?, invoiceprice=?,
197
            active=?,listprice=?, invoiceprice=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
199
            discount=?,notes=?,gstrate=?,deliverytime=?
199
            discount=?,notes=?,tax_rate=?,deliverytime=?
200
        WHERE id=?';
200
        WHERE id=?';
201
    my $sth = $dbh->prepare($query);
201
    my $sth = $dbh->prepare($query);
202
    my $cnt = $sth->execute(
202
    my $cnt = $sth->execute(
Lines 209-215 sub ModBookseller { Link Here
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
211
        $data->{'discount'},     $data->{'notes'},
211
        $data->{'discount'},     $data->{'notes'},
212
        $data->{'gstrate'},      $data->{deliverytime},
212
        $data->{'tax_rate'},      $data->{deliverytime},
213
        $data->{'id'}
213
        $data->{'id'}
214
    );
214
    );
215
    $contacts ||= $data->{'contacts'};
215
    $contacts ||= $data->{'contacts'};
(-)a/acqui/addorderiso2709.pl (-3 / +3 lines)
Lines 229-235 if ($op eq ""){ Link Here
229
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
229
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
230
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
230
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
231
            $price = Koha::Number::Price->new($price)->unformat;
231
            $price = Koha::Number::Price->new($price)->unformat;
232
            $orderinfo{gstrate} = $bookseller->{gstrate};
232
            $orderinfo{tax_rate} = $bookseller->{tax_rate};
233
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
233
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
234
            if ( $bookseller->{listincgst} ) {
234
            if ( $bookseller->{listincgst} ) {
235
                if ( $c_discount ) {
235
                if ( $c_discount ) {
Lines 241-250 if ($op eq ""){ Link Here
241
                }
241
                }
242
            } else {
242
            } else {
243
                if ( $c_discount ) {
243
                if ( $c_discount ) {
244
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
244
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
245
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
245
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
246
                } else {
246
                } else {
247
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
247
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
248
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
248
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
249
                }
249
                }
250
            }
250
            }
(-)a/acqui/basket.pl (-17 / +18 lines)
Lines 340-366 if ( $op eq 'delete_confirm' ) { Link Here
340
    my @book_foot_loop;
340
    my @book_foot_loop;
341
    my %foot;
341
    my %foot;
342
    my $total_quantity = 0;
342
    my $total_quantity = 0;
343
    my $total_gste = 0;
343
    my $total_tax_excluded = 0;
344
    my $total_gsti = 0;
344
    my $total_tax_included = 0;
345
    my $total_gstvalue = 0;
345
    my $total_tax_value = 0;
346
    for my $order (@orders) {
346
    for my $order (@orders) {
347
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
348
        my $line = get_order_infos( $order, $bookseller);
347
        my $line = get_order_infos( $order, $bookseller);
349
        if ( $line->{uncertainprice} ) {
348
        if ( $line->{uncertainprice} ) {
350
            $template->param( uncertainprices => 1 );
349
            $template->param( uncertainprices => 1 );
351
        }
350
        }
352
351
352
        $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format;
353
        $line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format;
354
353
        push @books_loop, $line;
355
        push @books_loop, $line;
354
356
355
        $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
357
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
356
        $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
358
        $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
357
        $total_gstvalue += $$line{gstvalue};
359
        $total_tax_value += $$line{tax_value};
358
        $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
360
        $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
359
        $total_quantity += $$line{quantity};
361
        $total_quantity += $$line{quantity};
360
        $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
362
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
361
        $total_gste += $$line{totalgste};
363
        $total_tax_excluded += $$line{total_tax_excluded};
362
        $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
364
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
363
        $total_gsti += $$line{totalgsti};
365
        $total_tax_included += $$line{total_tax_included};
364
    }
366
    }
365
367
366
    push @book_foot_loop, map {$_} values %foot;
368
    push @book_foot_loop, map {$_} values %foot;
Lines 369-375 if ( $op eq 'delete_confirm' ) { Link Here
369
    my @cancelledorders = GetCancelledOrders($basketno);
371
    my @cancelledorders = GetCancelledOrders($basketno);
370
    my @cancelledorders_loop;
372
    my @cancelledorders_loop;
371
    for my $order (@cancelledorders) {
373
    for my $order (@cancelledorders) {
372
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
373
        my $line = get_order_infos( $order, $bookseller);
374
        my $line = get_order_infos( $order, $bookseller);
374
        push @cancelledorders_loop, $line;
375
        push @cancelledorders_loop, $line;
375
    }
376
    }
Lines 421-429 if ( $op eq 'delete_confirm' ) { Link Here
421
        book_foot_loop       => \@book_foot_loop,
422
        book_foot_loop       => \@book_foot_loop,
422
        cancelledorders_loop => \@cancelledorders_loop,
423
        cancelledorders_loop => \@cancelledorders_loop,
423
        total_quantity       => $total_quantity,
424
        total_quantity       => $total_quantity,
424
        total_gste           => sprintf( "%.2f", $total_gste ),
425
        total_tax_excluded   => $total_tax_excluded,
425
        total_gsti           => sprintf( "%.2f", $total_gsti ),
426
        total_tax_included   => $total_tax_included,
426
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
427
        total_tax_value       => $total_tax_value,
427
        currency             => $cur->{'currency'},
428
        currency             => $cur->{'currency'},
428
        listincgst           => $bookseller->{listincgst},
429
        listincgst           => $bookseller->{listincgst},
429
        basketgroups         => $basketgroups,
430
        basketgroups         => $basketgroups,
Lines 449-455 sub get_order_infos { Link Here
449
    $line{budget_name}    = $budget->{budget_name};
450
    $line{budget_name}    = $budget->{budget_name};
450
451
451
    if ( $line{uncertainprice} ) {
452
    if ( $line{uncertainprice} ) {
452
        $line{rrpgste} .= ' (Uncertain)';
453
        $line{rrp_tax_excluded} .= ' (Uncertain)';
453
    }
454
    }
454
    if ( $line{'title'} ) {
455
    if ( $line{'title'} ) {
455
        my $volume      = $order->{'volume'};
456
        my $volume      = $order->{'volume'};
(-)a/acqui/basketgroup.pl (-6 / +13 lines)
Lines 76-84 sub BasketTotal { Link Here
76
    my $total = 0;
76
    my $total = 0;
77
    my @orders = GetOrders($basketno);
77
    my @orders = GetOrders($basketno);
78
    for my $order (@orders){
78
    for my $order (@orders){
79
        $total = $total + ( $order->{ecost} * $order->{quantity} );
79
        # FIXME The following is wrong
80
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) {
80
        if ( $bookseller->{listincgst} ) {
81
            my $gst = $bookseller->{gstrate} // C4::Context->preference("gist");
81
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
82
        } else {
83
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
84
        }
85
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{tax_rate} // C4::Context->preference("gist") )) {
86
            my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist");
82
            $total = $total * ( $gst / 100 +1);
87
            $total = $total * ( $gst / 100 +1);
83
        }
88
        }
84
    }
89
    }
Lines 169-181 sub printbasketgrouppdf{ Link Here
169
                croak $@;
174
                croak $@;
170
            }
175
            }
171
176
172
            $ord = C4::Acquisition::populate_order_with_prices({ order => $ord, booksellerid => $bookseller->{id}, ordering => 1 });
177
            $ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity};
178
            $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
179
173
            my $bib = GetBiblioData($ord->{biblionumber});
180
            my $bib = GetBiblioData($ord->{biblionumber});
174
            my $itemtypes = GetItemTypes();
181
            my $itemtypes = GetItemTypes();
175
182
176
            #FIXME DELETE ME
183
            #FIXME DELETE ME
177
            # 0      1        2        3         4            5         6       7      8        9
184
            # 0      1        2        3         4            5         6       7      8        9
178
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate
185
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount tax_rate
179
186
180
            # Editor Number
187
            # Editor Number
181
            my $en;
188
            my $en;
Lines 203-209 sub printbasketgrouppdf{ Link Here
203
        -type       => 'application/pdf',
210
        -type       => 'application/pdf',
204
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
211
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
205
    );
212
    );
206
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed";
213
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed";
207
    print $pdf;
214
    print $pdf;
208
215
209
}
216
}
(-)a/acqui/finishreceive.pl (-21 / +20 lines)
Lines 56-62 my $booksellerid = $input->param('booksellerid'); Link Here
56
my $cnt              = 0;
56
my $cnt              = 0;
57
my $ecost            = $input->param('ecost');
57
my $ecost            = $input->param('ecost');
58
my $rrp              = $input->param('rrp');
58
my $rrp              = $input->param('rrp');
59
my $order_internalnote = $input->param("order_internalnote");
60
my $bookfund         = $input->param("bookfund");
59
my $bookfund         = $input->param("bookfund");
61
my $order            = GetOrder($ordernumber);
60
my $order            = GetOrder($ordernumber);
62
my $new_ordernumber  = $ordernumber;
61
my $new_ordernumber  = $ordernumber;
Lines 83-122 if ($quantityrec > $origquantityrec ) { Link Here
83
        }
82
        }
84
    }
83
    }
85
84
85
    $order->{order_internalnote} = $input->param("order_internalnote");
86
    $order->{rrp} = $rrp;
86
    $order->{rrp} = $rrp;
87
    $order->{ecost} = $ecost;
87
    $order->{ecost} = $ecost;
88
    $order->{unitprice} = $unitprice;
88
    $order->{unitprice} = $unitprice;
89
90
    # FIXME is it still useful?
89
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
91
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
90
    if ( $bookseller->{listincgst} ) {
92
    if ( $bookseller->{listincgst} ) {
91
        if ( not $bookseller->{invoiceincgst} ) {
93
        if ( not $bookseller->{invoiceincgst} ) {
92
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
94
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{tax_rate} );
93
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
95
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{tax_rate} );
94
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
96
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{tax_rate} );
95
        }
97
        }
96
    } else {
98
    } else {
97
        if ( $bookseller->{invoiceincgst} ) {
99
        if ( $bookseller->{invoiceincgst} ) {
98
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
100
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{tax_rate} );
99
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
101
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{tax_rate} );
100
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
102
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{tax_rate} );
101
        }
103
        }
102
    }
104
    }
103
105
104
    # save the quantity received.
106
    # save the quantity received.
105
    if ( $quantityrec > 0 ) {
107
    if ( $quantityrec > 0 ) {
106
        ($datereceived, $new_ordernumber) = ModReceiveOrder({
108
        ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
107
              biblionumber     => $biblionumber,
109
            {
108
              ordernumber      => $ordernumber,
110
                biblionumber     => $biblionumber,
109
              quantityreceived => $quantityrec,
111
                order            => $order,
110
              user             => $user,
112
                quantityreceived => $quantityrec,
111
              cost             => $order->{unitprice},
113
                user             => $user,
112
              ecost            => $order->{ecost},
114
                invoice          => $invoice,
113
              invoiceid        => $invoiceid,
115
                budget_id        => $bookfund,
114
              rrp              => $order->{rrp},
116
                received_items   => \@received_items,
115
              budget_id        => $bookfund,
117
            }
116
              datereceived     => $datereceived,
118
        );
117
              received_items   => \@received_items,
118
              order_internalnote  => $order_internalnote,
119
        } );
120
    }
119
    }
121
120
122
    # now, add items if applicable
121
    # now, add items if applicable
(-)a/acqui/invoice.pl (-23 / +19 lines)
Lines 117-144 my $qty_total; Link Here
117
my @foot_loop;
117
my @foot_loop;
118
my %foot;
118
my %foot;
119
my $total_quantity = 0;
119
my $total_quantity = 0;
120
my $total_gste = 0;
120
my $total_tax_excluded = 0;
121
my $total_gsti = 0;
121
my $total_tax_included = 0;
122
my $total_gstvalue = 0;
122
my $total_tax_value = 0;
123
foreach my $order (@$orders) {
123
foreach my $order (@$orders) {
124
    $order = C4::Acquisition::populate_order_with_prices(
125
        {
126
            order        => $order,
127
            booksellerid => $bookseller->{id},
128
            receiving    => 1,
129
        }
130
    );
131
    my $line = get_infos( $order, $bookseller);
124
    my $line = get_infos( $order, $bookseller);
132
125
133
    $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
126
    $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format;
134
    $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
127
    $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format;
135
    $total_gstvalue += $$line{gstvalue};
128
136
    $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
129
    $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
130
    $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
131
    $total_tax_value += $$line{tax_value};
132
    $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
137
    $total_quantity += $$line{quantity};
133
    $total_quantity += $$line{quantity};
138
    $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
134
    $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
139
    $total_gste += $$line{totalgste};
135
    $total_tax_excluded += $$line{total_tax_excluded};
140
    $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
136
    $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
141
    $total_gsti += $$line{totalgsti};
137
    $total_tax_included += $$line{total_tax_included};
142
138
143
    $line->{orderline} = $line->{parent_ordernumber};
139
    $line->{orderline} = $line->{parent_ordernumber};
144
    push @orders_loop, $line;
140
    push @orders_loop, $line;
Lines 173-183 $template->param( Link Here
173
    orders_loop      => \@orders_loop,
169
    orders_loop      => \@orders_loop,
174
    foot_loop        => \@foot_loop,
170
    foot_loop        => \@foot_loop,
175
    total_quantity   => $total_quantity,
171
    total_quantity   => $total_quantity,
176
    total_gste       => sprintf( $format, $total_gste ),
172
    total_tax_excluded       => sprintf( $format, $total_tax_excluded ),
177
    total_gsti       => sprintf( $format, $total_gsti ),
173
    total_tax_included       => sprintf( $format, $total_tax_included ),
178
    total_gstvalue   => sprintf( $format, $total_gstvalue ),
174
    total_tax_value   => sprintf( $format, $total_tax_value ),
179
    total_gste_shipment => sprintf( $format, $total_gste + $details->{shipmentcost}),
175
    total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}),
180
    total_gsti_shipment => sprintf( $format, $total_gsti + $details->{shipmentcost}),
176
    total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}),
181
    invoiceincgst    => $bookseller->{invoiceincgst},
177
    invoiceincgst    => $bookseller->{invoiceincgst},
182
    currency         => GetCurrency()->{currency},
178
    currency         => GetCurrency()->{currency},
183
    budgets_loop     => \@budgets_loop,
179
    budgets_loop     => \@budgets_loop,
(-)a/acqui/neworderempty.pl (-2 / +2 lines)
Lines 307-313 if ( defined $subscriptionid ) { Link Here
307
        $budget_id              = $lastOrderReceived->{budgetid};
307
        $budget_id              = $lastOrderReceived->{budgetid};
308
        $data->{listprice}      = $lastOrderReceived->{listprice};
308
        $data->{listprice}      = $lastOrderReceived->{listprice};
309
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
309
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
310
        $data->{gstrate}        = $lastOrderReceived->{gstrate};
310
        $data->{tax_rate}        = $lastOrderReceived->{tax_rate};
311
        $data->{discount}       = $lastOrderReceived->{discount};
311
        $data->{discount}       = $lastOrderReceived->{discount};
312
        $data->{rrp}            = $lastOrderReceived->{rrp};
312
        $data->{rrp}            = $lastOrderReceived->{rrp};
313
        $data->{ecost}          = $lastOrderReceived->{ecost};
313
        $data->{ecost}          = $lastOrderReceived->{ecost};
Lines 390-396 $template->param( Link Here
390
    quantityrec      => $quantity,
390
    quantityrec      => $quantity,
391
    rrp              => $data->{'rrp'},
391
    rrp              => $data->{'rrp'},
392
    gst_values       => \@gst_values,
392
    gst_values       => \@gst_values,
393
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
393
    tax_rate          => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
394
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
394
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
395
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
395
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
396
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
396
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
(-)a/acqui/orderreceive.pl (-6 / +6 lines)
Lines 173-187 if ( $bookseller->{listincgst} ) { Link Here
173
        $ecost = $order->{ecost};
173
        $ecost = $order->{ecost};
174
        $unitprice = $order->{unitprice};
174
        $unitprice = $order->{unitprice};
175
    } else {
175
    } else {
176
        $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
176
        $rrp = $order->{rrp} / ( 1 + $order->{tax_rate} );
177
        $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
177
        $ecost = $order->{ecost} / ( 1 + $order->{tax_rate} );
178
        $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
178
        $unitprice = $order->{unitprice} / ( 1 + $order->{tax_rate} );
179
    }
179
    }
180
} else {
180
} else {
181
    if ( $bookseller->{invoiceincgst} ) {
181
    if ( $bookseller->{invoiceincgst} ) {
182
        $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
182
        $rrp = $order->{rrp} * ( 1 + $order->{tax_rate} );
183
        $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
183
        $ecost = $order->{ecost} * ( 1 + $order->{tax_rate} );
184
        $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
184
        $unitprice = $order->{unitprice} * ( 1 + $order->{tax_rate} );
185
    } else {
185
    } else {
186
        $rrp = $order->{rrp};
186
        $rrp = $order->{rrp};
187
        $ecost = $order->{ecost};
187
        $ecost = $order->{ecost};
(-)a/acqui/parcel.pl (-17 / +20 lines)
Lines 111-117 unless( $invoiceid and $invoice->{invoiceid} ) { Link Here
111
111
112
my $booksellerid = $invoice->{booksellerid};
112
my $booksellerid = $invoice->{booksellerid};
113
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
113
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
114
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
114
my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist") // 0;
115
my $datereceived = C4::Dates->new();
115
my $datereceived = C4::Dates->new();
116
116
117
my @orders        = @{ $invoice->{orders} };
117
my @orders        = @{ $invoice->{orders} };
Lines 119-139 my $countlines = scalar @orders; Link Here
119
my @loop_received = ();
119
my @loop_received = ();
120
my @book_foot_loop;
120
my @book_foot_loop;
121
my %foot;
121
my %foot;
122
my $total_gste = 0;
122
my $total_tax_excluded = 0;
123
my $total_gsti = 0;
123
my $total_tax_included = 0;
124
124
125
my $subtotal_for_funds;
125
my $subtotal_for_funds;
126
for my $order ( @orders ) {
126
for my $order ( @orders ) {
127
    $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 });
128
    $order->{'unitprice'} += 0;
127
    $order->{'unitprice'} += 0;
129
128
130
    if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
129
    if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
131
        $order->{ecost}     = $order->{ecostgste};
130
        $order->{ecost}     = $order->{ecost_tax_excluded};
132
        $order->{unitprice} = $order->{unitpricegste};
131
        $order->{unitprice} = $order->{unitprice_tax_excluded};
133
    }
132
    }
134
    elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
133
    elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
135
        $order->{ecost}     = $order->{ecostgsti};
134
        $order->{ecost}     = $order->{ecost_tax_included};
136
        $order->{unitprice} = $order->{unitpricegsti};
135
        $order->{unitprice} = $order->{unitprice_tax_included};
136
    } else {
137
        $order->{ecost} = $order->{ecost_tax_excluded};
138
        $order->{unitprice} = $order->{unitprice_tax_excluded};
137
    }
139
    }
138
    $order->{total} = $order->{unitprice} * $order->{quantity};
140
    $order->{total} = $order->{unitprice} * $order->{quantity};
139
141
Lines 146-155 for my $order ( @orders ) { Link Here
146
        $line{holds} += scalar( @$holds );
148
        $line{holds} += scalar( @$holds );
147
    }
149
    }
148
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
150
    $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
149
    $foot{$line{gstrate}}{gstrate} = $line{gstrate};
151
    $foot{$line{tax_rate}}{tax_rate} = $line{tax_rate};
150
    $foot{$line{gstrate}}{gstvalue} += $line{gstvalue};
152
    $foot{$line{tax_rate}}{tax_value} += $line{tax_value};
151
    $total_gste += $line{totalgste};
153
    $total_tax_excluded += Koha::Number::Price->new( $line{ecost_tax_excluded} * $line{quantity} )->format;
152
    $total_gsti += $line{totalgsti};
154
    $total_tax_included += Koha::Number::Price->new( $line{ecost_tax_included} * $line{quantity} )->format;
153
155
154
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
156
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
155
    $line{suggestionid}         = $suggestion->{suggestionid};
157
    $line{suggestionid}         = $suggestion->{suggestionid};
Lines 220-231 unless( defined $invoice->{closedate} ) { Link Here
220
222
221
    for (my $i = 0 ; $i < $countpendings ; $i++) {
223
    for (my $i = 0 ; $i < $countpendings ; $i++) {
222
        my $order = $pendingorders->[$i];
224
        my $order = $pendingorders->[$i];
223
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 });
224
225
225
        if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
226
        if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
226
            $order->{ecost} = $order->{ecostgste};
227
            $order->{ecost} = $order->{ecost_tax_excluded};
227
        } elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
228
        } elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
228
            $order->{ecost} = $order->{ecostgsti};
229
            $order->{ecost} = $order->{ecost_tax_included};
230
        } else {
231
            $order->{ecost} = $order->{ecost_tax_excluded};
229
        }
232
        }
230
        $order->{total} = $order->{ecost} * $order->{quantity};
233
        $order->{total} = $order->{ecost} * $order->{quantity};
231
234
Lines 291-298 $template->param( Link Here
291
    loop_orders           => \@loop_orders,
294
    loop_orders           => \@loop_orders,
292
    book_foot_loop        => \@book_foot_loop,
295
    book_foot_loop        => \@book_foot_loop,
293
    (uc(C4::Context->preference("marcflavour"))) => 1,
296
    (uc(C4::Context->preference("marcflavour"))) => 1,
294
    total_gste           => $total_gste,
297
    total_tax_excluded    => $total_tax_excluded,
295
    total_gsti           => $total_gsti,
298
    total_tax_included    => $total_tax_included,
296
    subtotal_for_funds    => $subtotal_for_funds,
299
    subtotal_for_funds    => $subtotal_for_funds,
297
    sticky_filters       => $sticky_filters,
300
    sticky_filters       => $sticky_filters,
298
);
301
);
(-)a/acqui/pdfformat/layout2pages.pm (-4 / +4 lines)
Lines 98-108 sub printorders { Link Here
98
                $basket->{basketno},
98
                $basket->{basketno},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
100
                $line->{quantity},
100
                $line->{quantity},
101
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
101
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
103
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{totalgste} )->format,
104
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
105
                Koha::Number::Price->new( $line->{totalgsti} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
106
            );
106
            );
107
            push(@$abaskets, $arrbasket);
107
            push(@$abaskets, $arrbasket);
108
        }
108
        }
(-)a/acqui/pdfformat/layout2pagesde.pm (-4 / +4 lines)
Lines 98-108 sub printorders { Link Here
98
                $basket->{basketno},
98
                $basket->{basketno},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
100
                $line->{quantity},
100
                $line->{quantity},
101
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
101
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
103
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{totalgste} )->format,
104
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
105
                Koha::Number::Price->new( $line->{totalgsti} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
106
            );
106
            );
107
            push(@$abaskets, $arrbasket);
107
            push(@$abaskets, $arrbasket);
108
        }
108
        }
(-)a/acqui/pdfformat/layout3pages.pm (-30 / +30 lines)
Lines 117-129 sub printorders { Link Here
117
            push( @$arrbasket,
117
            push( @$arrbasket,
118
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
118
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
119
                $line->{quantity},
119
                $line->{quantity},
120
                Koha::Number::Price->new( $line->{rrpgste} )->format,
120
                Koha::Number::Price->new( $line->{rrp_tax_excluded} )->format,
121
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
121
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
122
                Koha::Number::Price->new( $line->{discount} )->format . '%',
122
                Koha::Number::Price->new( $line->{discount} )->format . '%',
123
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
123
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
124
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
124
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
125
                Koha::Number::Price->new( $line->{totalgste} )->format,
125
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
126
                Koha::Number::Price->new( $line->{totalgsti} )->format,
126
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
127
            );
127
            );
128
            push(@$abaskets, $arrbasket);
128
            push(@$abaskets, $arrbasket);
129
        }
129
        }
Lines 209-251 sub printbaskets { Link Here
209
    for my $bkey (@keys) {
209
    for my $bkey (@keys) {
210
        push(@$arrbasket, $bkey);
210
        push(@$arrbasket, $bkey);
211
    }
211
    }
212
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
212
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
213
    # calculate each basket total
213
    # calculate each basket total
214
    push(@$abaskets, $arrbasket);
214
    push(@$abaskets, $arrbasket);
215
    for my $basket (@$hbaskets) {
215
    for my $basket (@$hbaskets) {
216
        my @gst;
216
        my @gst;
217
        $arrbasket = undef;
217
        $arrbasket = undef;
218
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
218
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
219
        my $ords = $orders->{$basket->{basketno}};
219
        my $ords = $orders->{$basket->{basketno}};
220
        my $ordlength = @$ords;
220
        my $ordlength = @$ords;
221
        foreach my $ord (@$ords) {
221
        foreach my $ord (@$ords) {
222
            $totalgste += $ord->{totalgste};
222
            $total_tax_excluded += $ord->{total_tax_excluded};
223
            $totalgsti += $ord->{totalgsti};
223
            $total_tax_included += $ord->{total_tax_included};
224
            $totalgstvalue += $ord->{gstvalue};
224
            $totaltax_value += $ord->{tax_value};
225
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
225
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
226
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
226
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
227
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
227
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
228
            push @gst, $ord->{gstrate};
228
            push @gst, $ord->{tax_rate};
229
        }
229
        }
230
        @gst = uniq map { $_ * 100 } @gst;
230
        @gst = uniq map { $_ * 100 } @gst;
231
        $grandtotalrrpgste += $totalrrpgste;
231
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
232
        $grandtotalrrpgsti += $totalrrpgsti;
232
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
233
        $grandtotalgsti += $totalgsti;
233
        $grandtotal_tax_included += $total_tax_included;
234
        $grandtotalgste += $totalgste;
234
        $grandtotal_tax_excluded += $total_tax_excluded;
235
        $grandtotalgstvalue += $totalgstvalue;
235
        $grandtotaltax_value += $totaltax_value;
236
        $grandtotaldiscount += $totaldiscount;
236
        $grandtotaldiscount += $totaldiscount;
237
        my @gst_string =
237
        my @gst_string =
238
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
238
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
239
        push(@$arrbasket,
239
        push(@$arrbasket,
240
            $basket->{contractname},
240
            $basket->{contractname},
241
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
241
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
242
            Koha::Number::Price->new( $totalrrpgste )->format,
242
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
243
            Koha::Number::Price->new( $totalrrpgsti )->format,
243
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
244
            "@gst_string",
244
            "@gst_string",
245
            Koha::Number::Price->new( $totalgstvalue )->format,
245
            Koha::Number::Price->new( $totaltax_value )->format,
246
            Koha::Number::Price->new( $totaldiscount )->format,
246
            Koha::Number::Price->new( $totaldiscount )->format,
247
            Koha::Number::Price->new( $totalgste )->format,
247
            Koha::Number::Price->new( $total_tax_excluded )->format,
248
            Koha::Number::Price->new( $totalgsti )->format,
248
            Koha::Number::Price->new( $total_tax_included )->format,
249
        );
249
        );
250
        push(@$abaskets, $arrbasket);
250
        push(@$abaskets, $arrbasket);
251
    }
251
    }
Lines 254-266 sub printbaskets { Link Here
254
    push @$arrbasket,
254
    push @$arrbasket,
255
      '',
255
      '',
256
      'Total',
256
      'Total',
257
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
257
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
258
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
258
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
259
      '',
259
      '',
260
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
260
      Koha::Number::Price->new( $grandtotaltax_value )->format,
261
      Koha::Number::Price->new( $grandtotaldiscount )->format,
261
      Koha::Number::Price->new( $grandtotaldiscount )->format,
262
      Koha::Number::Price->new( $grandtotalgste )->format,
262
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
263
      Koha::Number::Price->new( $grandtotalgsti )->format;
263
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
264
    push @$abaskets,$arrbasket;
264
    push @$abaskets,$arrbasket;
265
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
265
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
266
266
(-)a/acqui/pdfformat/layout3pagesfr.pm (-30 / +30 lines)
Lines 117-129 sub printorders { Link Here
117
            push( @$arrbasket,
117
            push( @$arrbasket,
118
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
118
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
119
                $line->{quantity},
119
                $line->{quantity},
120
                Koha::Number::Price->new( $line->{rrpgste})->format,
120
                Koha::Number::Price->new( $line->{rrp_tax_excluded})->format,
121
                Koha::Number::Price->new( $line->{rrpgsti})->format,
121
                Koha::Number::Price->new( $line->{rrp_tax_included})->format,
122
                Koha::Number::Price->new( $line->{discount})->format.'%',
122
                Koha::Number::Price->new( $line->{discount})->format.'%',
123
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
123
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
124
                Koha::Number::Price->new( $line->{gstrate} * 100)->format.'%',
124
                Koha::Number::Price->new( $line->{tax_rate} * 100)->format.'%',
125
                Koha::Number::Price->new( $line->{totalgste})->format,
125
                Koha::Number::Price->new( $line->{total_tax_excluded})->format,
126
                Koha::Number::Price->new( $line->{totalgsti})->format,
126
                Koha::Number::Price->new( $line->{total_tax_included})->format,
127
            );
127
            );
128
            push(@$abaskets, $arrbasket);
128
            push(@$abaskets, $arrbasket);
129
        }
129
        }
Lines 209-251 sub printbaskets { Link Here
209
    for my $bkey (@keys) {
209
    for my $bkey (@keys) {
210
        push(@$arrbasket, $bkey);
210
        push(@$arrbasket, $bkey);
211
    }
211
    }
212
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
212
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
213
    # calculate each basket total
213
    # calculate each basket total
214
    push(@$abaskets, $arrbasket);
214
    push(@$abaskets, $arrbasket);
215
    for my $basket (@$hbaskets) {
215
    for my $basket (@$hbaskets) {
216
        my @gst;
216
        my @gst;
217
        $arrbasket = undef;
217
        $arrbasket = undef;
218
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
218
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
219
        my $ords = $orders->{$basket->{basketno}};
219
        my $ords = $orders->{$basket->{basketno}};
220
        my $ordlength = @$ords;
220
        my $ordlength = @$ords;
221
        foreach my $ord (@$ords) {
221
        foreach my $ord (@$ords) {
222
            $totalgste += $ord->{totalgste};
222
            $total_tax_excluded += $ord->{total_tax_excluded};
223
            $totalgsti += $ord->{totalgsti};
223
            $total_tax_included += $ord->{total_tax_included};
224
            $totalgstvalue += $ord->{gstvalue};
224
            $totaltax_value += $ord->{tax_value};
225
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
225
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
226
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
226
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
227
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
227
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
228
            push @gst, $ord->{gstrate};
228
            push @gst, $ord->{tax_rate};
229
        }
229
        }
230
        @gst = uniq map { $_ * 100 } @gst;
230
        @gst = uniq map { $_ * 100 } @gst;
231
        $grandtotalrrpgste += $totalrrpgste;
231
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
232
        $grandtotalrrpgsti += $totalrrpgsti;
232
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
233
        $grandtotalgsti += $totalgsti;
233
        $grandtotal_tax_included += $total_tax_included;
234
        $grandtotalgste += $totalgste;
234
        $grandtotal_tax_excluded += $total_tax_excluded;
235
        $grandtotalgstvalue += $totalgstvalue;
235
        $grandtotaltax_value += $totaltax_value;
236
        $grandtotaldiscount += $totaldiscount;
236
        $grandtotaldiscount += $totaldiscount;
237
        my @gst_string =
237
        my @gst_string =
238
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
238
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
239
        push(@$arrbasket,
239
        push(@$arrbasket,
240
            $basket->{contractname},
240
            $basket->{contractname},
241
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
241
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
242
            Koha::Number::Price->new( $totalrrpgste )->format,
242
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
243
            Koha::Number::Price->new( $totalrrpgsti )->format,
243
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
244
            "@gst_string",
244
            "@gst_string",
245
            Koha::Number::Price->new( $totalgstvalue )->format,
245
            Koha::Number::Price->new( $totaltax_value )->format,
246
            Koha::Number::Price->new( $totaldiscount )->format,
246
            Koha::Number::Price->new( $totaldiscount )->format,
247
            Koha::Number::Price->new( $totalgste )->format,
247
            Koha::Number::Price->new( $total_tax_excluded )->format,
248
            Koha::Number::Price->new( $totalgsti )->format,
248
            Koha::Number::Price->new( $total_tax_included )->format,
249
        );
249
        );
250
        push(@$abaskets, $arrbasket);
250
        push(@$abaskets, $arrbasket);
251
    }
251
    }
Lines 254-266 sub printbaskets { Link Here
254
    push @$arrbasket,
254
    push @$arrbasket,
255
      '',
255
      '',
256
      'Total',
256
      'Total',
257
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
257
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
258
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
258
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
259
      '',
259
      '',
260
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
260
      Koha::Number::Price->new( $grandtotaltax_value )->format,
261
      Koha::Number::Price->new( $grandtotaldiscount )->format,
261
      Koha::Number::Price->new( $grandtotaldiscount )->format,
262
      Koha::Number::Price->new( $grandtotalgste )->format,
262
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
263
      Koha::Number::Price->new( $grandtotalgsti )->format;
263
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
264
    push @$abaskets,$arrbasket;
264
    push @$abaskets,$arrbasket;
265
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
265
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
266
266
(-)a/acqui/supplier.pl (-2 / +2 lines)
Lines 82-88 if ( $op eq 'display' ) { Link Here
82
82
83
    $template->param(
83
    $template->param(
84
        active        => $supplier->{'active'},
84
        active        => $supplier->{'active'},
85
        gstrate       => $supplier->{'gstrate'} + 0.0,
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
86
        invoiceprice  => $supplier->{'invoiceprice'},
86
        invoiceprice  => $supplier->{'invoiceprice'},
87
        listprice     => $supplier->{'listprice'},
87
        listprice     => $supplier->{'listprice'},
88
        basketcount   => $supplier->{'basketcount'},
88
        basketcount   => $supplier->{'basketcount'},
Lines 126-132 if ( $op eq 'display' ) { Link Here
126
    $template->param(
126
    $template->param(
127
        # set active ON by default for supplier add (id empty for add)
127
        # set active ON by default for supplier add (id empty for add)
128
        active       => $booksellerid ? $supplier->{'active'} : 1,
128
        active       => $booksellerid ? $supplier->{'active'} : 1,
129
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
129
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
130
        gst_values    => \@gst_values,
130
        gst_values    => \@gst_values,
131
        loop_currency => $loop_currency,
131
        loop_currency => $loop_currency,
132
        enter         => 1,
132
        enter         => 1,
(-)a/acqui/updatesupplier.pl (-2 / +2 lines)
Lines 39-45 Here is the list : Link Here
39
supplier, id, company, company_postal, physical, company_phone,
39
supplier, id, company, company_postal, physical, company_phone,
40
physical, company_phone, company_fax, website, company_email, notes,
40
physical, company_phone, company_fax, website, company_email, notes,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
42
discount, gstrate, contact_name, contact_position, contact_phone,
42
discount, tax_rate, contact_name, contact_position, contact_phone,
43
contact_altphone, contact_fax, contact_email, contact_notes,
43
contact_altphone, contact_fax, contact_email, contact_notes,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
45
contact_serialsprimary.
45
contact_serialsprimary.
Lines 97-103 $data{'gstreg'}=$input->param('gst'); Link Here
97
$data{'listincgst'}=$input->param('list_gst');
97
$data{'listincgst'}=$input->param('list_gst');
98
$data{'invoiceincgst'}=$input->param('invoice_gst');
98
$data{'invoiceincgst'}=$input->param('invoice_gst');
99
#have to transform this into fraction so it's easier to use
99
#have to transform this into fraction so it's easier to use
100
$data{'gstrate'} = $input->param('gstrate');
100
$data{'tax_rate'} = $input->param('tax_rate');
101
$data{'discount'} = $input->param('discount');
101
$data{'discount'} = $input->param('discount');
102
$data{deliverytime} = $input->param('deliverytime');
102
$data{deliverytime} = $input->param('deliverytime');
103
$data{'active'}=$input->param('status');
103
$data{'active'}=$input->param('status');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-46 / +46 lines)
Lines 9-20 Link Here
9
//<![CDATA[
9
//<![CDATA[
10
    function updateColumnsVisibility(visible) {
10
    function updateColumnsVisibility(visible) {
11
        if ( visible ) {
11
        if ( visible ) {
12
            $("table .gste, .gsti").show();
12
            $("table .tax_excluded, .tax_included").show();
13
        } else {
13
        } else {
14
            [% IF ( listincgst ) %]
14
            [% IF ( listincgst ) %]
15
                $("table .gste").hide();
15
                $("table .tax_excluded").hide();
16
            [% ELSE %]
16
            [% ELSE %]
17
                $("table .gsti").hide();
17
                $("table .tax_included").hide();
18
            [% END %]
18
            [% END %]
19
        }
19
        }
20
    }
20
    }
Lines 394-406 Link Here
394
                    <tr>
394
                    <tr>
395
                        <th>No.</th>
395
                        <th>No.</th>
396
                        <th>Order</th>
396
                        <th>Order</th>
397
                        <th class="gste">RRP tax exc.</th>
397
                        <th class="tax_excluded">RRP tax exc.</th>
398
                        <th class="gste">ecost tax exc.</th>
398
                        <th class="tax_excluded">ecost tax exc.</th>
399
                        <th class="gsti">RRP tax inc.</th>
399
                        <th class="tax_included">RRP tax inc.</th>
400
                        <th class="gsti">ecost tax inc.</th>
400
                        <th class="tax_included">ecost tax inc.</th>
401
                        <th>Qty.</th>
401
                        <th>Qty.</th>
402
                        <th class="gste">Total tax exc. ([% currency %])</th>
402
                        <th class="tax_excluded">Total tax exc. ([% currency %])</th>
403
                        <th class="gsti">Total tax inc. ([% currency %])</th>
403
                        <th class="tax_included">Total tax inc. ([% currency %])</th>
404
                        <th>GST %</th>
404
                        <th>GST %</th>
405
                        <th>GST</th>
405
                        <th>GST</th>
406
                        <th>Fund</th>
406
                        <th>Fund</th>
Lines 416-431 Link Here
416
                [% FOREACH foot_loo IN book_foot_loop %]
416
                [% FOREACH foot_loo IN book_foot_loop %]
417
                    <tr>
417
                    <tr>
418
                        <th></th>
418
                        <th></th>
419
                        <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
419
                        <th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
420
                        <th class="gste">&nbsp;</th>
420
                        <th class="tax_excluded">&nbsp;</th>
421
                        <th class="gste">&nbsp;</th>
421
                        <th class="tax_excluded">&nbsp;</th>
422
                        <th class="gsti">&nbsp;</th>
422
                        <th class="tax_included">&nbsp;</th>
423
                        <th class="gsti">&nbsp;</th>
423
                        <th class="tax_included">&nbsp;</th>
424
                        <th>[% foot_loo.quantity %]</th>
424
                        <th>[% foot_loo.quantity %]</th>
425
                        <th class="gste">[% foot_loo.totalgste | $Price%]</th>
425
                        <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
426
                        <th class="gsti">[% foot_loo.totalgsti | $Price %]</th>
426
                        <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
427
                        <th>&nbsp;</th>
427
                        <th>&nbsp;</th>
428
                        <th>[% foot_loo.gstvalue | $Price %]</th>
428
                        <th>[% foot_loo.tax_value | $Price %]</th>
429
                        <th>&nbsp;</th>
429
                        <th>&nbsp;</th>
430
                        [% IF ( active ) %]
430
                        [% IF ( active ) %]
431
                            [% UNLESS ( closedate ) %]
431
                            [% UNLESS ( closedate ) %]
Lines 438-452 Link Here
438
                <tr>
438
                <tr>
439
                    <th></th>
439
                    <th></th>
440
                    <th>Total ([% currency %])</th>
440
                    <th>Total ([% currency %])</th>
441
                    <th class="gste">&nbsp;</th>
441
                    <th class="tax_excluded">&nbsp;</th>
442
                    <th class="gste">&nbsp;</th>
442
                    <th class="tax_excluded">&nbsp;</th>
443
                    <th class="gsti">&nbsp;</th>
443
                    <th class="tax_included">&nbsp;</th>
444
                    <th class="gsti">&nbsp;</th>
444
                    <th class="tax_included">&nbsp;</th>
445
                    <th>[% total_quantity %]</th>
445
                    <th>[% total_quantity %]</th>
446
                    <th class="gste">[% total_gste | $Price %]</th>
446
                    <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
447
                    <th class="gsti">[% total_gsti | $Price %]</th>
447
                    <th class="tax_included">[% total_tax_included | $Price %]</th>
448
                    <th>&nbsp;</th>
448
                    <th>&nbsp;</th>
449
                    <th>[% total_gstvalue | $Price %]</th>
449
                    <th>[% total_tax_value | $Price %]</th>
450
                    <th>&nbsp;</th>
450
                    <th>&nbsp;</th>
451
                    [% IF ( active ) %]
451
                    [% IF ( active ) %]
452
                        [% UNLESS ( closedate ) %]
452
                        [% UNLESS ( closedate ) %]
Lines 503-517 Link Here
503
                        </td>
503
                        </td>
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
                        [% 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 ... %]
505
                        [%# 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 %]
506
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
506
                        <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
507
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
507
                        <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
508
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
508
                        <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
509
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
509
                        <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
510
                        <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>
511
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
511
                        <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
512
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
512
                        <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
513
                        <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
513
                        <td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
514
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
514
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
515
                        <td>[% books_loo.budget_name %]</td>
515
                        <td>[% books_loo.budget_name %]</td>
516
                        [% IF ( active ) %]
516
                        [% IF ( active ) %]
517
                            [% UNLESS ( closedate ) %]
517
                            [% UNLESS ( closedate ) %]
Lines 564-576 Link Here
564
                <tr>
564
                <tr>
565
                  <th>No.</th>
565
                  <th>No.</th>
566
                  <th>Order</th>
566
                  <th>Order</th>
567
                  <th class="gste">RRP tax exc.</th>
567
                  <th class="tax_excluded">RRP tax exc.</th>
568
                  <th class="gste">ecost tax exc.</th>
568
                  <th class="tax_excluded">ecost tax exc.</th>
569
                  <th class="gsti">RRP tax inc.</th>
569
                  <th class="tax_included">RRP tax inc.</th>
570
                  <th class="gsti">ecost tax inc.</th>
570
                  <th class="tax_included">ecost tax inc.</th>
571
                  <th>Qty.</th>
571
                  <th>Qty.</th>
572
                  <th class="gste">Total tax exc. ([% currency %])</th>
572
                  <th class="tax_excluded">Total tax exc. ([% currency %])</th>
573
                  <th class="gsti">Total tax inc. ([% currency %])</th>
573
                  <th class="tax_included">Total tax inc. ([% currency %])</th>
574
                  <th>GST %</th>
574
                  <th>GST %</th>
575
                  <th>GST</th>
575
                  <th>GST</th>
576
                  <th>Fund</th>
576
                  <th>Fund</th>
Lines 614-628 Link Here
614
                        </p>
614
                        </p>
615
                      [% END %]
615
                      [% END %]
616
                    </td>
616
                    </td>
617
                    <td class="number gste">[% order.rrpgste | $Price %]</td>
617
                    <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
618
                    <td class="number gste">[% order.ecostgste | $Price %]</td>
618
                    <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
619
                    <td class="number gsti">[% order.rrpgsti | $Price %]</td>
619
                    <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
620
                    <td class="number gsti">[% order.ecostgsti | $Price %]</td>
620
                    <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
621
                    <td class="number">[% order.quantity %]</td>
621
                    <td class="number">[% order.quantity %]</td>
622
                    <td class="number gste">[% order.totalgste | $Price %]</td>
622
                    <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
623
                    <td class="number gsti">[% order.totalgsti | $Price %]</td>
623
                    <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
624
                    <td class="number">[% order.gstrate * 100 | $Price %]</td>
624
                    <td class="number">[% order.tax_rate * 100 | $Price %]</td>
625
                    <td class="number">[% order.gstvalue | $Price %]</td>
625
                    <td class="number">[% order.tax_value | $Price %]</td>
626
                    <td>[% order.budget_name %]
626
                    <td>[% order.budget_name %]
627
                  </tr>
627
                  </tr>
628
                [% END %]
628
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-27 / +27 lines)
Lines 12-23 Link Here
12
//<![CDATA[
12
//<![CDATA[
13
    function updateColumnsVisibility(visible) {
13
    function updateColumnsVisibility(visible) {
14
        if ( visible ) {
14
        if ( visible ) {
15
            $("table .gste, .gsti").show();
15
            $("table .tax_excluded, .tax_included").show();
16
        } else {
16
        } else {
17
            [% IF ( invoiceincgst ) %]
17
            [% IF ( invoiceincgst ) %]
18
                $("table .gste").hide();
18
                $("table .tax_excluded").hide();
19
            [% ELSE %]
19
            [% ELSE %]
20
                $("table .gsti").hide();
20
                $("table .tax_included").hide();
21
            [% END %]
21
            [% END %]
22
        }
22
        }
23
    }
23
    }
Lines 134-144 Link Here
134
                <th>Summary</th>
134
                <th>Summary</th>
135
                <th>Publisher</th>
135
                <th>Publisher</th>
136
                <th>Library</th>
136
                <th>Library</th>
137
                <th class="gste">Actual cost tax exc.</th>
137
                <th class="tax_excluded">Actual cost tax exc.</th>
138
                <th class="gsti">Actual cost tax inc.</th>
138
                <th class="tax_included">Actual cost tax inc.</th>
139
                <th>Qty.</th>
139
                <th>Qty.</th>
140
                <th class="gste">Total tax exc. ([% currency %])</th>
140
                <th class="tax_excluded">Total tax exc. ([% currency %])</th>
141
                <th class="gsti">Total tax inc. ([% currency %])</th>
141
                <th class="tax_included">Total tax inc. ([% currency %])</th>
142
                <th>GST %</th>
142
                <th>GST %</th>
143
                <th>GST</th>
143
                <th>GST</th>
144
                <th>Fund</th>
144
                <th>Fund</th>
Lines 162-174 Link Here
162
                    [% END %]
162
                    [% END %]
163
                  </td>
163
                  </td>
164
                  <td><p>[% order.branchcode %]</p></td>
164
                  <td><p>[% order.branchcode %]</p></td>
165
                  <td class="number gste">[% order.unitpricegste | $Price %]</td>
165
                  <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
166
                  <td class="number gsti">[% order.unitpricegsti | $Price %]</td>
166
                  <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
167
                  <td class="number">[% order.quantity %]</td>
167
                  <td class="number">[% order.quantity %]</td>
168
                  <td class="number gste">[% order.totalgste | $Price %]</td>
168
                  <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
169
                  <td class="number gsti">[% order.totalgsti | $Price %]</td>
169
                  <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
170
                  <td class="number">[% order.gstrate * 100 | $Price %]</td>
170
                  <td class="number">[% order.tax_rate * 100 | $Price %]</td>
171
                  <td class="number">[% order.gstvalue | $Price %]</td>
171
                  <td class="number">[% order.tax_value | $Price %]</td>
172
                  <td>[% order.budget_name %]</td>
172
                  <td>[% order.budget_name %]</td>
173
                </tr>
173
                </tr>
174
              [% END %]
174
              [% END %]
Lines 176-210 Link Here
176
            <tfoot>
176
            <tfoot>
177
              [% FOR tf IN foot_loop %]
177
              [% FOR tf IN foot_loop %]
178
                <tr>
178
                <tr>
179
                    <th colspan='3'>Total (GST [% tf.gstrate * 100 | $Price %] %)</th>
179
                    <th colspan='3'>Total (GST [% tf.tax_rate * 100 | $Price %] %)</th>
180
                    <th class="gste"/><th class="gsti"/>
180
                    <th class="tax_excluded"/><th class="tax_included"/>
181
                    <th>[% tf.quantity %]</th>
181
                    <th>[% tf.quantity %]</th>
182
                    <th class="gste">[% tf.totalgste | $Price %]</th>
182
                    <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
183
                    <th class="gsti">[% tf.totalgsti | $Price %]</th>
183
                    <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
184
                    <th>&nbsp;</th>
184
                    <th>&nbsp;</th>
185
                    <th>[% tf.gstvalue | $Price %]</th>
185
                    <th>[% tf.tax_value | $Price %]</th>
186
                    <th>&nbsp;</th>
186
                    <th>&nbsp;</th>
187
                </tr>
187
                </tr>
188
              [% END %]
188
              [% END %]
189
              <tr>
189
              <tr>
190
                <th colspan='3'>Total ([% currency %])</th>
190
                <th colspan='3'>Total ([% currency %])</th>
191
                <th class="gste"/><th class="gsti"/>
191
                <th class="tax_excluded"/><th class="tax_included"/>
192
                <th>[% total_quantity %]</th>
192
                <th>[% total_quantity %]</th>
193
                <th class="gste">[% total_gste | $Price %]</th>
193
                <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
194
                <th class="gsti">[% total_gsti | $Price %]</th>
194
                <th class="tax_included">[% total_tax_included | $Price %]</th>
195
                <th>&nbsp;</th>
195
                <th>&nbsp;</th>
196
                <th>[% total_gstvalue | $Price %]</th>
196
                <th>[% total_tax_value | $Price %]</th>
197
                <th>&nbsp;</th>
197
                <th>&nbsp;</th>
198
              </tr>
198
              </tr>
199
              <tr>
199
              <tr>
200
                <th colspan="3">Total + Shipment cost ([% currency %])</th>
200
                <th colspan="3">Total + Shipment cost ([% currency %])</th>
201
                <th class="gste"></th>
201
                <th class="tax_excluded"></th>
202
                <th class="gsti"></th>
202
                <th class="tax_included"></th>
203
                <th>[% total_quantity %]</th>
203
                <th>[% total_quantity %]</th>
204
                <th class="gste">[% total_gste_shipment | $Price %]</th>
204
                <th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th>
205
                <th class="gsti">[% total_gsti_shipment | $Price %]</th>
205
                <th class="tax_included">[% total_tax_included_shipment | $Price %]</th>
206
                <th>&nbsp;</th>
206
                <th>&nbsp;</th>
207
                <th>[% total_gstvalue | $Price %]</th>
207
                <th>[% total_tax_value | $Price %]</th>
208
                <th>&nbsp;</th>
208
                <th>&nbsp;</th>
209
              </tr>
209
              </tr>
210
            </tfoot>
210
            </tfoot>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-5 / +5 lines)
Lines 495-506 $(document).ready(function() Link Here
495
                <li>
495
                <li>
496
                    [% IF ( close ) %]
496
                    [% IF ( close ) %]
497
                        <span class="label">Tax rate: </span>
497
                        <span class="label">Tax rate: </span>
498
                        <input type="hidden" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
498
                        <input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate %]" />[% tax_rate %]%
499
                    [% ELSE %]
499
                    [% ELSE %]
500
                        <label for="gstrate">Tax rate: </label>
500
                        <label for="tax_rate">Tax rate: </label>
501
                        <select name="gstrate" id="gstrate" onchange="updateCosts();">
501
                        <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
502
                        [% FOREACH gst IN gst_values %]
502
                        [% FOREACH gst IN gst_values %]
503
                          [% IF ( gst.option == gstrate ) %]
503
                          [% IF ( gst.option == tax_rate ) %]
504
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
504
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
505
                          [% ELSE %]
505
                          [% ELSE %]
506
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
506
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
Lines 509-515 $(document).ready(function() Link Here
509
                        </select>
509
                        </select>
510
                    [% END %]
510
                    [% END %]
511
                [% ELSE %]
511
                [% ELSE %]
512
                    <input type="hidden" name="gstrate" value="0" />
512
                    <input type="hidden" name="tax_rate" value="0" />
513
                </li>
513
                </li>
514
            [% END %]
514
            [% END %]
515
            <li>
515
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-1 / +1 lines)
Lines 258-264 Link Here
258
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
258
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
259
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
259
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
260
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
260
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
261
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
261
    <input type="hidden" name="tax_rate" value="[% tax_rate %]" />
262
	</div>
262
	</div>
263
	<div class="yui-u">
263
	<div class="yui-u">
264
    <fieldset class="rows">
264
    <fieldset class="rows">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-4 / +4 lines)
Lines 357-375 Link Here
357
        [% END %]
357
        [% END %]
358
        <tr>
358
        <tr>
359
            <th colspan="10" class="total">Total tax exc.</th>
359
            <th colspan="10" class="total">Total tax exc.</th>
360
            <th>[% total_gste | $Price %]</th>
360
            <th>[% total_tax_excluded | $Price %]</th>
361
            <th></th>
361
            <th></th>
362
        </tr>
362
        </tr>
363
        [% FOREACH book_foot IN book_foot_loop %]
363
        [% FOREACH book_foot IN book_foot_loop %]
364
            <tr>
364
            <tr>
365
                <th colspan="10">Total (GST [% book_foot.gstrate * 100 | $Price %]%)</th>
365
                <th colspan="10">Total (GST [% book_foot.tax_rate * 100 | $Price %]%)</th>
366
                <th>[% book_foot.gstvalue | $Price %]</th>
366
                <th>[% book_foot.tax_value | $Price %]</th>
367
                <th></th>
367
                <th></th>
368
            </tr>
368
            </tr>
369
        [% END %]
369
        [% END %]
370
        <tr>
370
        <tr>
371
            <th colspan="10" class="total">Total tax inc.</th>
371
            <th colspan="10" class="total">Total tax inc.</th>
372
            <th>[% total_gsti | $Price %]</th>
372
            <th>[% total_tax_included | $Price %]</th>
373
            <th></th>
373
            <th></th>
374
        </tr>
374
        </tr>
375
    </tfoot>
375
    </tfoot>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-6 / +6 lines)
Lines 268-277 function delete_contact(ev) { Link Here
268
            [% IF gst_values %]
268
            [% IF gst_values %]
269
                <ol>
269
                <ol>
270
                  <li>
270
                  <li>
271
                    <label for="gstrate">Tax rate: </label>
271
                    <label for="tax_rate">Tax rate: </label>
272
                    <select name="gstrate" id="gstrate">
272
                    <select name="tax_rate" id="tax_rate">
273
                    [% FOREACH gst IN gst_values %]
273
                    [% FOREACH gst IN gst_values %]
274
                      [% IF ( gstrate == gst.option ) %]
274
                      [% IF ( tax_rate == gst.option ) %]
275
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
275
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
276
                      [% ELSE %]
276
                      [% ELSE %]
277
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
277
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
Lines 281-287 function delete_contact(ev) { Link Here
281
                  </li>
281
                  </li>
282
                </ol>
282
                </ol>
283
            [% ELSE %]
283
            [% ELSE %]
284
                <input type="hidden" name="gstrate" value="0" />
284
                <input type="hidden" name="tax_rate" value="0" />
285
            [% END %]
285
            [% END %]
286
            <ol>
286
            <ol>
287
            <li><label for="discount">Discount: </label>
287
            <li><label for="discount">Discount: </label>
Lines 325-331 function delete_contact(ev) { Link Here
325
                        [% END %]</p>
325
                        [% END %]</p>
326
                <p><strong>List prices are: </strong>[% listprice %]</p>
326
                <p><strong>List prices are: </strong>[% listprice %]</p>
327
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
327
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
328
                [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
328
                [% IF ( tax_rate ) %]<p><strong>Tax number registered: </strong>
329
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
329
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
330
                <p><strong>List item price includes tax: </strong>
330
                <p><strong>List item price includes tax: </strong>
331
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
331
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 334-340 function delete_contact(ev) { Link Here
334
                <p><strong>Discount: </strong>
334
                <p><strong>Discount: </strong>
335
                    [% discount | format("%.1f") %] %</p>
335
                    [% discount | format("%.1f") %] %</p>
336
                <p><strong>Tax rate: </strong>
336
                <p><strong>Tax rate: </strong>
337
                    [% 0 + gstrate * 100 | format("%.1f") %] %</p>
337
                    [% 0 + tax_rate * 100 | format("%.1f") %] %</p>
338
                [% IF deliverytime.defined %]
338
                [% IF deliverytime.defined %]
339
                    <p><strong>Delivery time: </strong>
339
                    <p><strong>Delivery time: </strong>
340
                        [% deliverytime %] days</p>
340
                        [% deliverytime %] days</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt (-1 / +1 lines)
Lines 68-74 Link Here
68
    <li>A basket with at least one uncertain price can't be closed.</li>
68
    <li>A basket with at least one uncertain price can't be closed.</li>
69
</ul>
69
</ul>
70
</li>
70
</li>
71
    <li>If you are charged sales tax, choose that from the gstrate field</li>
71
    <li>If you are charged sales tax, choose that from the tax_rate field</li>
72
    <li>Enter the percentage discount you're receiving on this order, once you enter this, hit tab and Koha will populate the rest of the cost fields below.</li>
72
    <li>Enter the percentage discount you're receiving on this order, once you enter this, hit tab and Koha will populate the rest of the cost fields below.</li>
73
    <li>If you added Planning Values when creating the Fund, those values will appear in the two Planning Value fields.</li>
73
    <li>If you added Planning Values when creating the Fund, those values will appear in the two Planning Value fields.</li>
74
</ul>
74
</ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-4 / +4 lines)
Lines 325-332 $(document).ready(function() { Link Here
325
                <tbody>
325
                <tbody>
326
                    <tr>
326
                    <tr>
327
                        <td>Ordered amount</td>
327
                        <td>Ordered amount</td>
328
                        <td>[% valuegste_ordered %]</td>
328
                        <td>[% value_tax_excluded_ordered %]</td>
329
                        <td>[% valuegsti_ordered %]</td>
329
                        <td>[% value_tax_included_ordered %]</td>
330
                        <td>[% budget_name_ordered %]</td>
330
                        <td>[% budget_name_ordered %]</td>
331
                        <td>
331
                        <td>
332
                            [% IF ( ordered_exists ) %]
332
                            [% IF ( ordered_exists ) %]
Lines 336-343 $(document).ready(function() { Link Here
336
                    </tr>
336
                    </tr>
337
                    <tr>
337
                    <tr>
338
                        <td>Spent amount</td>
338
                        <td>Spent amount</td>
339
                        <td>[% valuegste_spent %]</td>
339
                        <td>[% value_tax_excluded_spent %]</td>
340
                        <td>[% valuegsti_spent %]</td>
340
                        <td>[% value_tax_included_spent %]</td>
341
                        <td>[% budget_name_spent %]</td>
341
                        <td>[% budget_name_spent %]</td>
342
                        <td>
342
                        <td>
343
                            [% IF ( spent_exists ) %]
343
                            [% IF ( spent_exists ) %]
(-)a/misc/devel/update_dbix_class_files.pl (-3 / +3 lines)
Lines 26-34 my $path = "./"; Link Here
26
my $db_driver = 'mysql';
26
my $db_driver = 'mysql';
27
my $db_host = 'localhost';
27
my $db_host = 'localhost';
28
my $db_port = '3306';
28
my $db_port = '3306';
29
my $db_name = '';
29
my $db_name = 'koha_vat_ut';
30
my $db_user = '';
30
my $db_user = 'root';
31
my $db_passwd = '';
31
my $db_passwd = 'root';
32
GetOptions(
32
GetOptions(
33
    "path=s"      => \$path,
33
    "path=s"      => \$path,
34
    "db_driver=s" => \$db_driver,
34
    "db_driver=s" => \$db_driver,
(-)a/serials/subscription-detail.pl (-15 / +15 lines)
Lines 120-128 if ( defined $subscriptionid ) { Link Here
120
    if ( defined $lastOrderNotReceived ) {
120
    if ( defined $lastOrderNotReceived ) {
121
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
121
        my $basket = GetBasket $lastOrderNotReceived->{basketno};
122
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
122
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
123
        ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
123
        ( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller );
124
        $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
124
        $tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} );
125
        $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
125
        $tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} );
126
        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
126
        $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
127
        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
127
        $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
128
        $tmpl_infos->{ordered_exists} = 1;
128
        $tmpl_infos->{ordered_exists} = 1;
Lines 130-138 if ( defined $subscriptionid ) { Link Here
130
    if ( defined $lastOrderReceived ) {
130
    if ( defined $lastOrderReceived ) {
131
        my $basket = GetBasket $lastOrderReceived->{basketno};
131
        my $basket = GetBasket $lastOrderReceived->{basketno};
132
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
132
        my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
133
        ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
133
        ( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller );
134
        $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
134
        $tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} );
135
        $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
135
        $tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} );
136
        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
136
        $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
137
        $tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid};
137
        $tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid};
138
        $tmpl_infos->{spent_exists} = 1;
138
        $tmpl_infos->{spent_exists} = 1;
Lines 180-200 sub get_default_view { Link Here
180
180
181
sub get_value_with_gst_params {
181
sub get_value_with_gst_params {
182
    my $value = shift;
182
    my $value = shift;
183
    my $gstrate = shift;
183
    my $tax_rate = shift;
184
    my $bookseller = shift;
184
    my $bookseller = shift;
185
    if ( $bookseller->{listincgst} ) {
185
    if ( $bookseller->{listincgst} ) {
186
        return ( $value, $value / ( 1 + $gstrate ) );
186
        return ( $value, $value / ( 1 + $tax_rate ) );
187
    } else {
187
    } else {
188
        return ( $value * ( 1 + $gstrate ), $value );
188
        return ( $value * ( 1 + $tax_rate ), $value );
189
    }
189
    }
190
}
190
}
191
191
192
sub get_gste {
192
sub get_tax_excluded {
193
    my $value = shift;
193
    my $value = shift;
194
    my $gstrate = shift;
194
    my $tax_rate = shift;
195
    my $bookseller = shift;
195
    my $bookseller = shift;
196
    if ( $bookseller->{invoiceincgst} ) {
196
    if ( $bookseller->{invoiceincgst} ) {
197
        return $value / ( 1 + $gstrate );
197
        return $value / ( 1 + $tax_rate );
198
    } else {
198
    } else {
199
        return $value;
199
        return $value;
200
    }
200
    }
Lines 202-212 sub get_gste { Link Here
202
202
203
sub get_gst {
203
sub get_gst {
204
    my $value = shift;
204
    my $value = shift;
205
    my $gstrate = shift;
205
    my $tax_rate = shift;
206
    my $bookseller = shift;
206
    my $bookseller = shift;
207
    if ( $bookseller->{invoiceincgst} ) {
207
    if ( $bookseller->{invoiceincgst} ) {
208
        return $value / ( 1 + $gstrate ) * $gstrate;
208
        return $value / ( 1 + $tax_rate ) * $tax_rate;
209
    } else {
209
    } else {
210
        return $value * ( 1 + $gstrate ) - $value;
210
        return $value * ( 1 + $tax_rate ) - $value;
211
    }
211
    }
212
}
212
}
(-)a/t/Prices.t (-105 / +104 lines)
Lines 41-47 for my $currency_format ( qw( US FR ) ) { Link Here
41
            invoiceid        => $invoiceid_0_0,
41
            invoiceid        => $invoiceid_0_0,
42
            rrp              => 82.00,
42
            rrp              => 82.00,
43
            ecost            => 73.80,
43
            ecost            => 73.80,
44
            gstrate          => 0.0500,
44
            tax_rate         => 0.0500,
45
            discount         => 10.0000,
45
            discount         => 10.0000,
46
            datereceived     => $today
46
            datereceived     => $today
47
        };
47
        };
Lines 56-113 for my $currency_format ( qw( US FR ) ) { Link Here
56
        # Note that this configuration is correct \o/
56
        # Note that this configuration is correct \o/
57
        compare(
57
        compare(
58
            {
58
            {
59
                got      => $order_0_0->{rrpgsti},
59
                got      => $order_0_0->{rrp_tax_included},
60
                expected => 86.10,
60
                expected => 86.10,
61
                conf     => '0 0',
61
                conf     => '0 0',
62
                field    => 'rrpgsti'
62
                field    => 'rrp_tax_included'
63
            }
63
            }
64
        );
64
        );
65
        compare(
65
        compare(
66
            {
66
            {
67
                got      => $order_0_0->{rrpgste},
67
                got      => $order_0_0->{rrp_tax_excluded},
68
                expected => 82.00,
68
                expected => 82.00,
69
                conf     => '0 0',
69
                conf     => '0 0',
70
                field    => 'rrpgste'
70
                field    => 'rrp_tax_excluded'
71
            }
71
            }
72
        );
72
        );
73
        compare(
73
        compare(
74
            {
74
            {
75
                got      => $order_0_0->{ecostgsti},
75
                got      => $order_0_0->{ecost_tax_included},
76
                expected => 77.49,
76
                expected => 77.49,
77
                conf     => '0 0',
77
                conf     => '0 0',
78
                field    => 'ecostgsti'
78
                field    => 'ecost_tax_included'
79
            }
79
            }
80
        );
80
        );
81
        compare(
81
        compare(
82
            {
82
            {
83
                got      => $order_0_0->{ecostgste},
83
                got      => $order_0_0->{ecost_tax_excluded},
84
                expected => 73.80,
84
                expected => 73.80,
85
                conf     => '0 0',
85
                conf     => '0 0',
86
                field    => 'ecostgste'
86
                field    => 'ecost_tax_excluded'
87
            }
87
            }
88
        );
88
        );
89
        compare(
89
        compare(
90
            {
90
            {
91
                got      => $order_0_0->{gstvalue},
91
                got      => $order_0_0->{tax_value},
92
                expected => 7.38,
92
                expected => 7.38,
93
                conf     => '0 0',
93
                conf     => '0 0',
94
                field    => 'gstvalue'
94
                field    => 'tax_value'
95
            }
95
            }
96
        );
96
        );
97
        compare(
97
        compare(
98
            {
98
            {
99
                got      => $order_0_0->{totalgsti},
99
                got      => $order_0_0->{total_tax_included},
100
                expected => 154.98,
100
                expected => 154.98,
101
                conf     => '0 0',
101
                conf     => '0 0',
102
                field    => 'totalgsti'
102
                field    => 'total_tax_included'
103
            }
103
            }
104
        );
104
        );
105
        compare(
105
        compare(
106
            {
106
            {
107
                got      => $order_0_0->{totalgste},
107
                got      => $order_0_0->{total_tax_excluded},
108
                expected => 147.60,
108
                expected => 147.60,
109
                conf     => '0 0',
109
                conf     => '0 0',
110
                field    => 'totalgste'
110
                field    => 'total_tax_excluded'
111
            }
111
            }
112
        );
112
        );
113
113
Lines 122-163 for my $currency_format ( qw( US FR ) ) { Link Here
122
        # Note that this configuration is correct \o/
122
        # Note that this configuration is correct \o/
123
        compare(
123
        compare(
124
            {
124
            {
125
                got      => $order_0_0->{unitpricegsti},
125
                got      => $order_0_0->{unitprice_tax_included},
126
                expected => 77.49,
126
                expected => 77.49,
127
                conf     => '0 0',
127
                conf     => '0 0',
128
                field    => 'unitpricegsti'
128
                field    => 'unitprice_tax_included'
129
            }
129
            }
130
        );
130
        );
131
        compare(
131
        compare(
132
            {
132
            {
133
                got      => $order_0_0->{unitpricegste},
133
                got      => $order_0_0->{unitprice_tax_excluded},
134
                expected => 73.80,
134
                expected => 73.80,
135
                conf     => '0 0',
135
                conf     => '0 0',
136
                field    => 'unitpricegste'
136
                field    => 'unitprice_tax_excluded'
137
            }
137
            }
138
        );
138
        );
139
        compare(
139
        compare(
140
            {
140
            {
141
                got      => $order_0_0->{gstvalue},
141
                got      => $order_0_0->{tax_value},
142
                expected => 7.38,
142
                expected => 7.38,
143
                conf     => '0 0',
143
                conf     => '0 0',
144
                field    => 'gstvalue'
144
                field    => 'tax_value'
145
            }
145
            }
146
        );
146
        );
147
        compare(
147
        compare(
148
            {
148
            {
149
                got      => $order_0_0->{totalgsti},
149
                got      => $order_0_0->{total_tax_included},
150
                expected => 154.98,
150
                expected => 154.98,
151
                conf     => '0 0',
151
                conf     => '0 0',
152
                field    => 'totalgsti'
152
                field    => 'total_tax_included'
153
            }
153
            }
154
        );
154
        );
155
        compare(
155
        compare(
156
            {
156
            {
157
                got      => $order_0_0->{totalgste},
157
                got      => $order_0_0->{total_tax_excluded},
158
                expected => 147.60,
158
                expected => 147.60,
159
                conf     => '0 0',
159
                conf     => '0 0',
160
                field    => 'totalgste'
160
                field    => 'total_tax_excluded'
161
            }
161
            }
162
        );
162
        );
163
    };
163
    };
Lines 182-188 for my $currency_format ( qw( US FR ) ) { Link Here
182
            invoiceid        => $invoiceid_1_1,
182
            invoiceid        => $invoiceid_1_1,
183
            rrp              => 82.00,
183
            rrp              => 82.00,
184
            ecost            => 73.80,
184
            ecost            => 73.80,
185
            gstrate          => 0.0500,
185
            tax_rate         => 0.0500,
186
            discount         => 10.0000,
186
            discount         => 10.0000,
187
            datereceived     => $today
187
            datereceived     => $today
188
        };
188
        };
Lines 196-256 for my $currency_format ( qw( US FR ) ) { Link Here
196
        );
196
        );
197
197
198
        # Note that this configuration is *not* correct
198
        # Note that this configuration is *not* correct
199
        # gstvalue should be 7.03 instead of 7.02
199
        # tax_value should be 7.03 instead of 7.02
200
        compare(
200
        compare(
201
            {
201
            {
202
                got      => $order_1_1->{rrpgsti},
202
                got      => $order_1_1->{rrp_tax_included},
203
                expected => 82.00,
203
                expected => 82.00,
204
                conf     => '1 1',
204
                conf     => '1 1',
205
                field    => 'rrpgsti'
205
                field    => 'rrp_tax_included'
206
            }
206
            }
207
        );
207
        );
208
        compare(
208
        compare(
209
            {
209
            {
210
                got      => $order_1_1->{rrpgste},
210
                got      => $order_1_1->{rrp_tax_excluded},
211
                expected => 78.10,
211
                expected => 78.10,
212
                conf     => '1 1',
212
                conf     => '1 1',
213
                field    => 'rrpgste'
213
                field    => 'rrp_tax_excluded'
214
            }
214
            }
215
        );
215
        );
216
        compare(
216
        compare(
217
            {
217
            {
218
                got      => $order_1_1->{ecostgsti},
218
                got      => $order_1_1->{ecost_tax_included},
219
                expected => 73.80,
219
                expected => 73.80,
220
                conf     => '1 1',
220
                conf     => '1 1',
221
                field    => 'ecostgsti'
221
                field    => 'ecost_tax_included'
222
            }
222
            }
223
        );
223
        );
224
        compare(
224
        compare(
225
            {
225
            {
226
                got      => $order_1_1->{ecostgste},
226
                got      => $order_1_1->{ecost_tax_excluded},
227
                expected => 70.29,
227
                expected => 70.29,
228
                conf     => '1 1',
228
                conf     => '1 1',
229
                field    => 'ecostgste'
229
                field    => 'ecost_tax_excluded'
230
            }
230
            }
231
        );
231
        );
232
        compare(
232
        compare(
233
            {
233
            {
234
                got      => $order_1_1->{gstvalue},
234
                got      => $order_1_1->{tax_value},
235
                expected => 7.02,
235
                expected => 7.02,
236
                conf     => '1 1',
236
                conf     => '1 1',
237
                field    => 'gstvalue'
237
                field    => 'tax_value'
238
            }
238
            }
239
        );
239
        );
240
        compare(
240
        compare(
241
            {
241
            {
242
                got      => $order_1_1->{totalgsti},
242
                got      => $order_1_1->{total_tax_included},
243
                expected => 147.60,
243
                expected => 147.60,
244
                conf     => '1 1',
244
                conf     => '1 1',
245
                field    => 'totalgsti'
245
                field    => 'total_tax_included'
246
            }
246
            }
247
        );
247
        );
248
        compare(
248
        compare(
249
            {
249
            {
250
                got      => $order_1_1->{totalgste},
250
                got      => $order_1_1->{total_tax_excluded},
251
                expected => 140.58,
251
                expected => 140.58,
252
                conf     => '1 1',
252
                conf     => '1 1',
253
                field    => 'totalgste'
253
                field    => 'total_tax_excluded'
254
            }
254
            }
255
        );
255
        );
256
256
Lines 262-306 for my $currency_format ( qw( US FR ) ) { Link Here
262
            }
262
            }
263
        );
263
        );
264
        # Note that this configuration is *not* correct!
264
        # Note that this configuration is *not* correct!
265
        # gstvalue should be 7.03
265
        # tax_value should be 7.03
266
        compare(
266
        compare(
267
            {
267
            {
268
                got      => $order_1_1->{unitpricegsti},
268
                got      => $order_1_1->{unitprice_tax_included},
269
                expected => 73.80,
269
                expected => 73.80,
270
                conf     => '1 1',
270
                conf     => '1 1',
271
                field    => 'unitpricegsti'
271
                field    => 'unitprice_tax_included'
272
            }
272
            }
273
        );
273
        );
274
        compare(
274
        compare(
275
            {
275
            {
276
                got      => $order_1_1->{unitpricegste},
276
                got      => $order_1_1->{unitprice_tax_excluded},
277
                expected => 70.29,
277
                expected => 70.29,
278
                conf     => '1 1',
278
                conf     => '1 1',
279
                field    => 'unitpricegste'
279
                field    => 'unitprice_tax_excluded'
280
            }
280
            }
281
        );
281
        );
282
        compare(
282
        compare(
283
            {
283
            {
284
                got      => $order_1_1->{gstvalue},
284
                got      => $order_1_1->{tax_value},
285
                expected => 7.02,
285
                expected => 7.02,
286
                conf     => '1 1',
286
                conf     => '1 1',
287
                field    => 'gstvalue'
287
                field    => 'tax_value'
288
            }
288
            }
289
        );
289
        );
290
        compare(
290
        compare(
291
            {
291
            {
292
                got      => $order_1_1->{totalgsti},
292
                got      => $order_1_1->{total_tax_included},
293
                expected => 147.60,
293
                expected => 147.60,
294
                conf     => '1 1',
294
                conf     => '1 1',
295
                field    => 'totalgsti'
295
                field    => 'total_tax_included'
296
            }
296
            }
297
        );
297
        );
298
        compare(
298
        compare(
299
            {
299
            {
300
                got      => $order_1_1->{totalgste},
300
                got      => $order_1_1->{total_tax_excluded},
301
                expected => 140.58,
301
                expected => 140.58,
302
                conf     => '1 1',
302
                conf     => '1 1',
303
                field    => 'totalgste'
303
                field    => 'total_tax_excluded'
304
            }
304
            }
305
        );
305
        );
306
    };
306
    };
Lines 325-331 for my $currency_format ( qw( US FR ) ) { Link Here
325
            invoiceid        => $invoiceid_1_1,
325
            invoiceid        => $invoiceid_1_1,
326
            rrp              => 82.01,
326
            rrp              => 82.01,
327
            ecost            => 73.80,
327
            ecost            => 73.80,
328
            gstrate          => 0.0500,
328
            tax_rate         => 0.0500,
329
            discount         => 10.0000,
329
            discount         => 10.0000,
330
            datereceived     => $today
330
            datereceived     => $today
331
        };
331
        };
Lines 339-402 for my $currency_format ( qw( US FR ) ) { Link Here
339
        );
339
        );
340
340
341
        # Note that this configuration is *not* correct!
341
        # Note that this configuration is *not* correct!
342
        # rrp gsti should be 82 (what we inserted!)
342
        # rrp_tax_included should be 82 (what we inserted!)
343
        # => Actually we need to fix the inserted value (here we have 82.01 in DB)
343
        # tax_value should be 7.03 instead of 7.02
344
        # gstvalue should be 7.03 instead of 7.02
345
344
346
        compare(
345
        compare(
347
            {
346
            {
348
                got      => $order_1_0->{rrpgsti},
347
                got      => $order_1_0->{rrp_tax_included},
349
                expected => 82.01,
348
                expected => 82.01,
350
                conf     => '1 0',
349
                conf     => '1 0',
351
                field    => 'rrpgsti'
350
                field    => 'rrp_tax_included'
352
            }
351
            }
353
        );
352
        );
354
        compare(
353
        compare(
355
            {
354
            {
356
                got      => $order_1_0->{rrpgste},
355
                got      => $order_1_0->{rrp_tax_excluded},
357
                expected => 78.10,
356
                expected => 78.10,
358
                conf     => '1 0',
357
                conf     => '1 0',
359
                field    => 'rrpgste'
358
                field    => 'rrp_tax_excluded'
360
            }
359
            }
361
        );
360
        );
362
        compare(
361
        compare(
363
            {
362
            {
364
                got      => $order_1_0->{ecostgsti},
363
                got      => $order_1_0->{ecost_tax_included},
365
                expected => 73.80,
364
                expected => 73.80,
366
                conf     => '1 0',
365
                conf     => '1 0',
367
                field    => 'ecostgsti'
366
                field    => 'ecost_tax_included'
368
            }
367
            }
369
        );
368
        );
370
        compare(
369
        compare(
371
            {
370
            {
372
                got      => $order_1_0->{ecostgste},
371
                got      => $order_1_0->{ecost_tax_excluded},
373
                expected => 70.29,
372
                expected => 70.29,
374
                conf     => '1 0',
373
                conf     => '1 0',
375
                field    => 'ecostgste'
374
                field    => 'ecost_tax_excluded'
376
            }
375
            }
377
        );
376
        );
378
        compare(
377
        compare(
379
            {
378
            {
380
                got      => $order_1_0->{gstvalue},
379
                got      => $order_1_0->{tax_value},
381
                expected => 7.02,
380
                expected => 7.02,
382
                conf     => '1 0',
381
                conf     => '1 0',
383
                field    => 'gstvalue'
382
                field    => 'tax_value'
384
            }
383
            }
385
        );
384
        );
386
        compare(
385
        compare(
387
            {
386
            {
388
                got      => $order_1_0->{totalgsti},
387
                got      => $order_1_0->{total_tax_included},
389
                expected => 147.60,
388
                expected => 147.60,
390
                conf     => '1 0',
389
                conf     => '1 0',
391
                field    => 'totalgsti'
390
                field    => 'total_tax_included'
392
            }
391
            }
393
        );
392
        );
394
        compare(
393
        compare(
395
            {
394
            {
396
                got      => $order_1_0->{totalgste},
395
                got      => $order_1_0->{total_tax_excluded},
397
                expected => 140.58,
396
                expected => 140.58,
398
                conf     => '1 0',
397
                conf     => '1 0',
399
                field    => 'totalgste'
398
                field    => 'total_tax_excluded'
400
            }
399
            }
401
        );
400
        );
402
401
Lines 411-452 for my $currency_format ( qw( US FR ) ) { Link Here
411
        # gstvalue should be 7.03
410
        # gstvalue should be 7.03
412
        compare(
411
        compare(
413
            {
412
            {
414
                got      => $order_1_0->{unitpricegsti},
413
                got      => $order_1_0->{unitprice_tax_included},
415
                expected => 73.80,
414
                expected => 73.80,
416
                conf     => '1 0',
415
                conf     => '1 0',
417
                field    => 'unitpricegsti'
416
                field    => 'unitprice_tax_included'
418
            }
417
            }
419
        );
418
        );
420
        compare(
419
        compare(
421
            {
420
            {
422
                got      => $order_1_0->{unitpricegste},
421
                got      => $order_1_0->{unitprice_tax_excluded},
423
                expected => 70.29,
422
                expected => 70.29,
424
                conf     => '1 0',
423
                conf     => '1 0',
425
                field    => 'unitpricegste'
424
                field    => 'unitprice_tax_excluded'
426
            }
425
            }
427
        );
426
        );
428
        compare(
427
        compare(
429
            {
428
            {
430
                got      => $order_1_0->{gstvalue},
429
                got      => $order_1_0->{tax_value},
431
                expected => 7.02,
430
                expected => 7.02,
432
                conf     => '1 0',
431
                conf     => '1 0',
433
                field    => 'gstvalue'
432
                field    => 'tax_value'
434
            }
433
            }
435
        );
434
        );
436
        compare(
435
        compare(
437
            {
436
            {
438
                got      => $order_1_0->{totalgsti},
437
                got      => $order_1_0->{total_tax_included},
439
                expected => 147.60,
438
                expected => 147.60,
440
                conf     => '1 0',
439
                conf     => '1 0',
441
                field    => 'totalgsti'
440
                field    => 'total_tax_included'
442
            }
441
            }
443
        );
442
        );
444
        compare(
443
        compare(
445
            {
444
            {
446
                got      => $order_1_0->{totalgste},
445
                got      => $order_1_0->{total_tax_excluded},
447
                expected => 140.58,
446
                expected => 140.58,
448
                conf     => '1 0',
447
                conf     => '1 0',
449
                field    => 'totalgste'
448
                field    => 'total_tax_excluded'
450
            }
449
            }
451
        );
450
        );
452
    };
451
    };
Lines 471-477 for my $currency_format ( qw( US FR ) ) { Link Here
471
            invoiceid        => $invoiceid_1_1,
470
            invoiceid        => $invoiceid_1_1,
472
            rrp              => 82.00,
471
            rrp              => 82.00,
473
            ecost            => 73.80,
472
            ecost            => 73.80,
474
            gstrate          => 0.0500,
473
            tax_rate         => 0.0500,
475
            discount         => 10.0000,
474
            discount         => 10.0000,
476
            datereceived     => $today
475
            datereceived     => $today
477
        };
476
        };
Lines 487-544 for my $currency_format ( qw( US FR ) ) { Link Here
487
        # Note that this configuration is correct \o/
486
        # Note that this configuration is correct \o/
488
        compare(
487
        compare(
489
            {
488
            {
490
                got      => $order_0_1->{rrpgsti},
489
                got      => $order_0_1->{rrp_tax_included},
491
                expected => 86.10,
490
                expected => 86.10,
492
                conf     => '1 0',
491
                conf     => '1 0',
493
                field    => 'rrpgsti'
492
                field    => 'rrp_tax_included'
494
            }
493
            }
495
        );
494
        );
496
        compare(
495
        compare(
497
            {
496
            {
498
                got      => $order_0_1->{rrpgste},
497
                got      => $order_0_1->{rrp_tax_excluded},
499
                expected => 82.00,
498
                expected => 82.00,
500
                conf     => '1 0',
499
                conf     => '1 0',
501
                field    => 'rrpgste'
500
                field    => 'rrp_tax_excluded'
502
            }
501
            }
503
        );
502
        );
504
        compare(
503
        compare(
505
            {
504
            {
506
                got      => $order_0_1->{ecostgsti},
505
                got      => $order_0_1->{ecost_tax_included},
507
                expected => 77.49,
506
                expected => 77.49,
508
                conf     => '1 0',
507
                conf     => '1 0',
509
                field    => 'ecostgsti'
508
                field    => 'ecost_tax_included'
510
            }
509
            }
511
        );
510
        );
512
        compare(
511
        compare(
513
            {
512
            {
514
                got      => $order_0_1->{ecostgste},
513
                got      => $order_0_1->{ecost_tax_excluded},
515
                expected => 73.80,
514
                expected => 73.80,
516
                conf     => '1 0',
515
                conf     => '1 0',
517
                field    => 'ecostgste'
516
                field    => 'ecost_tax_excluded'
518
            }
517
            }
519
        );
518
        );
520
        compare(
519
        compare(
521
            {
520
            {
522
                got      => $order_0_1->{gstvalue},
521
                got      => $order_0_1->{tax_value},
523
                expected => 7.38,
522
                expected => 7.38,
524
                conf     => '1 0',
523
                conf     => '1 0',
525
                field    => 'gstvalue'
524
                field    => 'tax_value'
526
            }
525
            }
527
        );
526
        );
528
        compare(
527
        compare(
529
            {
528
            {
530
                got      => $order_0_1->{totalgsti},
529
                got      => $order_0_1->{total_tax_included},
531
                expected => 154.98,
530
                expected => 154.98,
532
                conf     => '1 0',
531
                conf     => '1 0',
533
                field    => 'totalgsti'
532
                field    => 'total_tax_included'
534
            }
533
            }
535
        );
534
        );
536
        compare(
535
        compare(
537
            {
536
            {
538
                got      => $order_0_1->{totalgste},
537
                got      => $order_0_1->{total_tax_excluded},
539
                expected => 147.60,
538
                expected => 147.60,
540
                conf     => '1 0',
539
                conf     => '1 0',
541
                field    => 'totalgste'
540
                field    => 'total_tax_excluded'
542
            }
541
            }
543
        );
542
        );
544
543
Lines 552-593 for my $currency_format ( qw( US FR ) ) { Link Here
552
        # Note that this configuration is correct
551
        # Note that this configuration is correct
553
        compare(
552
        compare(
554
            {
553
            {
555
                got      => $order_0_1->{unitpricegsti},
554
                got      => $order_0_1->{unitprice_tax_included},
556
                expected => 77.49,
555
                expected => 77.49,
557
                conf     => '0 1',
556
                conf     => '0 1',
558
                field    => 'unitpricegsti'
557
                field    => 'unitprice_tax_included'
559
            }
558
            }
560
        );
559
        );
561
        compare(
560
        compare(
562
            {
561
            {
563
                got      => $order_0_1->{unitpricegste},
562
                got      => $order_0_1->{unitprice_tax_excluded},
564
                expected => 73.80,
563
                expected => 73.80,
565
                conf     => '0 1',
564
                conf     => '0 1',
566
                field    => 'unitpricegste'
565
                field    => 'unitprice_tax_excluded'
567
            }
566
            }
568
        );
567
        );
569
        compare(
568
        compare(
570
            {
569
            {
571
                got      => $order_0_1->{gstvalue},
570
                got      => $order_0_1->{tax_value},
572
                expected => 7.38,
571
                expected => 7.38,
573
                conf     => '0 1',
572
                conf     => '0 1',
574
                field    => 'gstvalue'
573
                field    => 'tax_value'
575
            }
574
            }
576
        );
575
        );
577
        compare(
576
        compare(
578
            {
577
            {
579
                got      => $order_0_1->{totalgsti},
578
                got      => $order_0_1->{total_tax_included},
580
                expected => 154.98,
579
                expected => 154.98,
581
                conf     => '0 1',
580
                conf     => '0 1',
582
                field    => 'totalgsti'
581
                field    => 'total_tax_included'
583
            }
582
            }
584
        );
583
        );
585
        compare(
584
        compare(
586
            {
585
            {
587
                got      => $order_0_1->{totalgste},
586
                got      => $order_0_1->{total_tax_excluded},
588
                expected => 147.60,
587
                expected => 147.60,
589
                conf     => '0 1',
588
                conf     => '0 1',
590
                field    => 'totalgste'
589
                field    => 'total_tax_excluded'
591
            }
590
            }
592
        );
591
        );
593
    };
592
    };
(-)a/t/db_dependent/Acquisition.t (-37 / +49 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use POSIX qw(strftime);
20
use POSIX qw(strftime);
21
21
22
use Test::More tests => 88;
22
use Test::More tests => 87;
23
23
24
BEGIN {
24
BEGIN {
25
    use_ok('C4::Acquisition');
25
    use_ok('C4::Acquisition');
Lines 177-183 my @order_content = ( Link Here
177
            ecost     => 38.15,
177
            ecost     => 38.15,
178
            rrp       => 40.15,
178
            rrp       => 40.15,
179
            discount  => 5.1111,
179
            discount  => 5.1111,
180
            gstrate   => 0.0515
180
            tax_rate   => 0.0515
181
        }
181
        }
182
    },
182
    },
183
    {
183
    {
Lines 205-211 my @order_content = ( Link Here
205
            ecost     => 38.1,
205
            ecost     => 38.1,
206
            rrp       => 11.0,
206
            rrp       => 11.0,
207
            discount  => 5.1,
207
            discount  => 5.1,
208
            gstrate   => 0.1
208
            tax_rate   => 0.1
209
        }
209
        }
210
    },
210
    },
211
    {
211
    {
Lines 225-231 my @order_content = ( Link Here
225
            rrp            => 11.00,
225
            rrp            => 11.00,
226
            discount       => 0,
226
            discount       => 0,
227
            uncertainprice => 0,
227
            uncertainprice => 0,
228
            gstrate        => 0
228
            tax_rate        => 0
229
        }
229
        }
230
    },
230
    },
231
    {
231
    {
Lines 245-251 my @order_content = ( Link Here
245
            rrp            => 10,
245
            rrp            => 10,
246
            discount       => 0,
246
            discount       => 0,
247
            uncertainprice => 0,
247
            uncertainprice => 0,
248
            gstrate        => 0
248
            tax_rate        => 0
249
        }
249
        }
250
    }
250
    }
251
);
251
);
Lines 336-341 my @expectedfields = qw( Link Here
336
  invoiceid
336
  invoiceid
337
  freight
337
  freight
338
  unitprice
338
  unitprice
339
  unitprice_tax_included
340
  unitprice_tax_excluded
339
  quantityreceived
341
  quantityreceived
340
  datecancellationprinted
342
  datecancellationprinted
341
  supplierreference
343
  supplierreference
Lines 343-352 my @expectedfields = qw( Link Here
343
  basketno
345
  basketno
344
  timestamp
346
  timestamp
345
  rrp
347
  rrp
348
  rrp_tax_included
349
  rrp_tax_excluded
346
  ecost
350
  ecost
351
  ecost_tax_included
352
  ecost_tax_excluded
347
  unitpricesupplier
353
  unitpricesupplier
348
  unitpricelib
354
  unitpricelib
349
  gstrate
355
  tax_rate
356
  tax_value
350
  discount
357
  discount
351
  budget_id
358
  budget_id
352
  budgetgroup_id
359
  budgetgroup_id
Lines 411-416 my @base_expectedfields = qw( Link Here
411
  notes
418
  notes
412
  ordernumber
419
  ordernumber
413
  ecost
420
  ecost
421
  ecost_tax_included
422
  ecost_tax_excluded
414
  uncertainprice
423
  uncertainprice
415
  marc
424
  marc
416
  url
425
  url
Lines 441-446 my @base_expectedfields = qw( Link Here
441
  budget_parent_id
450
  budget_parent_id
442
  publishercode
451
  publishercode
443
  unitprice
452
  unitprice
453
  unitprice_tax_included
454
  unitprice_tax_excluded
444
  collectionvolume
455
  collectionvolume
445
  budget_amount
456
  budget_amount
446
  budget_owner_id
457
  budget_owner_id
Lines 459-465 my @base_expectedfields = qw( Link Here
459
  supplierreference
470
  supplierreference
460
  agerestriction
471
  agerestriction
461
  budget_branchcode
472
  budget_branchcode
462
  gstrate
473
  tax_rate
474
  tax_value
463
  listprice
475
  listprice
464
  budget_code
476
  budget_code
465
  budgetdate
477
  budgetdate
Lines 483-488 my @base_expectedfields = qw( Link Here
483
  sort2_authcat
495
  sort2_authcat
484
  budget_expend
496
  budget_expend
485
  rrp
497
  rrp
498
  rrp_tax_included
499
  rrp_tax_excluded
486
  cn_sort
500
  cn_sort
487
  totalamount
501
  totalamount
488
  lccn
502
  lccn
Lines 573-578 ok( Link Here
573
  firstname
587
  firstname
574
  biblioitemnumber
588
  biblioitemnumber
575
  ecost
589
  ecost
590
  ecost_tax_included
591
  ecost_tax_excluded
576
  uncertainprice
592
  uncertainprice
577
  creationdate
593
  creationdate
578
  datereceived
594
  datereceived
Lines 580-586 ok( Link Here
580
  supplierreference
596
  supplierreference
581
  isbn
597
  isbn
582
  copyrightdate
598
  copyrightdate
583
  gstrate
599
  tax_rate
600
  tax_value
584
  serial
601
  serial
585
  listprice
602
  listprice
586
  budgetdate
603
  budgetdate
Lines 607-613 ok( Link Here
607
  unititle
624
  unititle
608
  sort2_authcat
625
  sort2_authcat
609
  rrp
626
  rrp
627
  rrp_tax_included
628
  rrp_tax_excluded
610
  unitprice
629
  unitprice
630
  unitprice_tax_included
631
  unitprice_tax_excluded
611
  totalamount
632
  totalamount
612
  sort1
633
  sort1
613
  ordernumber
634
  ordernumber
Lines 634-648 my $invoiceid = AddInvoice( Link Here
634
    unknown       => "unknown"
655
    unknown       => "unknown"
635
);
656
);
636
657
658
my $invoice = GetInvoice( $invoiceid );
659
637
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
660
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
638
    {
661
    {
639
        biblionumber      => $biblionumber4,
662
        biblionumber      => $biblionumber4,
640
        ordernumber       => $ordernumbers[4],
663
        order             => GetOrder( $ordernumbers[4] ),
641
        quantityreceived  => 1,
664
        quantityreceived  => 1,
642
        cost              => 10,
665
        invoice           => $invoice,
643
        ecost             => 10,
644
        invoiceid         => $invoiceid,
645
        rrp               => 10,
646
        budget_id          => $order_content[4]->{str}->{budget_id},
666
        budget_id          => $order_content[4]->{str}->{budget_id},
647
    }
667
    }
648
);
668
);
Lines 800-819 is( Link Here
800
    "AddClaim : Check claimed_date"
820
    "AddClaim : Check claimed_date"
801
);
821
);
802
822
823
my $order2 = GetOrder( $ordernumbers[1] );
824
$order2->{order_internalnote} = "my notes";
803
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
825
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
804
    {
826
    {
805
        biblionumber     => $biblionumber2,
827
        biblionumber     => $biblionumber2,
806
        ordernumber      => $ordernumbers[1],
828
        order            => $order2,
807
        quantityreceived => 2,
829
        quantityreceived => 2,
808
        cost             => 12,
830
        invoice          => $invoice,
809
        ecost            => 12,
810
        invoiceid        => $invoiceid,
811
        rrp              => 42,
812
        order_internalnote => "my notes",
813
        order_vendornote   => "my vendor notes",
814
    }
831
    }
815
);
832
)
816
my $order2 = GetOrder( $ordernumbers[1] );
833
;
834
$order2 = GetOrder( $ordernumbers[1] );
817
is( $order2->{'quantityreceived'},
835
is( $order2->{'quantityreceived'},
818
    0, 'Splitting up order did not receive any on original order' );
836
    0, 'Splitting up order did not receive any on original order' );
819
is( $order2->{'quantity'}, 40, '40 items on original order' );
837
is( $order2->{'quantity'}, 40, '40 items on original order' );
Lines 821-828 is( $order2->{'budget_id'}, $budgetid, Link Here
821
    'Budget on original order is unchanged' );
839
    'Budget on original order is unchanged' );
822
is( $order2->{order_internalnote}, "my notes",
840
is( $order2->{order_internalnote}, "my notes",
823
    'ModReceiveOrder and GetOrder deal with internal notes' );
841
    'ModReceiveOrder and GetOrder deal with internal notes' );
824
is( $order2->{order_vendornote}, "my vendor notes",
825
    'ModReceiveOrder and GetOrder deal with vendor notes' );
826
842
827
$neworder = GetOrder($new_ordernumber);
843
$neworder = GetOrder($new_ordernumber);
828
is( $neworder->{'quantity'}, 2, '2 items on new order' );
844
is( $neworder->{'quantity'}, 2, '2 items on new order' );
Lines 845-865 my $budgetid2 = C4::Budgets::AddBudget( Link Here
845
    }
861
    }
846
);
862
);
847
863
864
my $order3 = GetOrder( $ordernumbers[2] );
865
$order3->{order_internalnote} = "my other notes";
848
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
866
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
849
    {
867
    {
850
        biblionumber     => $biblionumber2,
868
        biblionumber     => $biblionumber2,
851
        ordernumber      => $ordernumbers[2],
869
        order            => $order3,
852
        quantityreceived => 2,
870
        quantityreceived => 2,
853
        cost             => 12,
871
        invoice          => $invoice,
854
        ecost            => 12,
855
        invoiceid        => $invoiceid,
856
        rrp              => 42,
857
        budget_id        => $budgetid2,
872
        budget_id        => $budgetid2,
858
        order_internalnote => "my other notes",
859
    }
873
    }
860
);
874
);
861
875
862
my $order3 = GetOrder( $ordernumbers[2] );
876
$order3 = GetOrder( $ordernumbers[2] );
863
is( $order3->{'quantityreceived'},
877
is( $order3->{'quantityreceived'},
864
    0, 'Splitting up order did not receive any on original order' );
878
    0, 'Splitting up order did not receive any on original order' );
865
is( $order3->{'quantity'}, 2, '2 items on original order' );
879
is( $order3->{'quantity'}, 2, '2 items on original order' );
Lines 874-890 is( $neworder->{'quantityreceived'}, Link Here
874
    2, 'Splitting up order received items on new order' );
888
    2, 'Splitting up order received items on new order' );
875
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
889
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
876
890
891
$order3 = GetOrder( $ordernumbers[2] );
892
$order3->{order_internalnote} = "my third notes";
877
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
893
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
878
    {
894
    {
879
        biblionumber     => $biblionumber2,
895
        biblionumber     => $biblionumber2,
880
        ordernumber      => $ordernumbers[2],
896
        order            => $order3,
881
        quantityreceived => 2,
897
        quantityreceived => 2,
882
        cost             => 12,
898
        invoice          => $invoice,
883
        ecost            => 12,
884
        invoiceid        => $invoiceid,
885
        rrp              => 42,
886
        budget_id        => $budgetid2,
899
        budget_id        => $budgetid2,
887
        order_internalnote => "my third notes",
888
    }
900
    }
889
);
901
);
890
902
(-)a/t/db_dependent/Acquisition/CancelReceipt.t (-6 / +3 lines)
Lines 58-66 my $ordernumber = $order->{ordernumber}; Link Here
58
ModReceiveOrder(
58
ModReceiveOrder(
59
    {
59
    {
60
        biblionumber     => $biblionumber,
60
        biblionumber     => $biblionumber,
61
        ordernumber      => $ordernumber,
61
        order            => $order,
62
        quantityreceived => 2,
62
        quantityreceived => 2,
63
        datereceived     => dt_from_string
64
    }
63
    }
65
);
64
);
66
65
Lines 68-75 $order->add_item( $itemnumber ); Link Here
68
67
69
CancelReceipt($ordernumber);
68
CancelReceipt($ordernumber);
70
69
71
$order = GetOrder( $ordernumber );
70
is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
72
is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
73
71
74
my $itemnumber1 = AddItem({}, $biblionumber);
72
my $itemnumber1 = AddItem({}, $biblionumber);
75
my $itemnumber2 = AddItem({}, $biblionumber);
73
my $itemnumber2 = AddItem({}, $biblionumber);
Lines 101-109 is( Link Here
101
my ( undef, $new_ordernumber ) = ModReceiveOrder(
99
my ( undef, $new_ordernumber ) = ModReceiveOrder(
102
    {
100
    {
103
        biblionumber     => $biblionumber,
101
        biblionumber     => $biblionumber,
104
        ordernumber      => $ordernumber,
102
        order            => $order,
105
        quantityreceived => 1,
103
        quantityreceived => 1,
106
        datereceived     => dt_from_string,
107
        received_items   => [ $itemnumber1 ],
104
        received_items   => [ $itemnumber1 ],
108
    }
105
    }
109
);
106
);
(-)a/t/db_dependent/Acquisition/Invoices.t (-16 / +11 lines)
Lines 92-117 my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $bookse Link Here
92
                            shipmentdate => '2012-12-24',
92
                            shipmentdate => '2012-12-24',
93
                           );
93
                           );
94
94
95
my $invoice1 = GetInvoice( $invoiceid1 );
96
my $invoice2 = GetInvoice( $invoiceid2 );
97
95
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
98
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
96
    {
99
    {
97
        biblionumber     => $biblionumber1,
100
        biblionumber     => $biblionumber1,
98
        ordernumber      => $ordernumber1,
101
        order            => $order1,
99
        quantityreceived => 2,
102
        quantityreceived => 2,
100
        cost             => 12,
103
        invoice          => $invoice1,
101
        ecost            => 12,
102
        invoiceid        => $invoiceid1,
103
        rrp              => 42
104
    }
104
    }
105
);
105
);
106
106
107
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
107
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
108
    {
108
    {
109
        biblionumber     => $biblionumber2,
109
        biblionumber     => $biblionumber2,
110
        ordernumber      => $ordernumber2,
110
        order            => $order2,
111
        quantityreceived => 1,
111
        quantityreceived => 1,
112
        cost             => 5,
112
        invoice          => $invoice2,
113
        ecost            => 5,
114
        invoiceid        => $invoiceid2,
115
        rrp              => 42
113
        rrp              => 42
116
    }
114
    }
117
);
115
);
Lines 119-135 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( Link Here
119
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
117
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
120
    {
118
    {
121
        biblionumber     => $biblionumber3,
119
        biblionumber     => $biblionumber3,
122
        ordernumber      => $ordernumber3,
120
        order            => $order3,
123
        quantityreceived => 1,
121
        quantityreceived => 1,
124
        cost             => 12,
122
        invoice          => $invoice2,
125
        ecost            => 12,
126
        invoiceid        => $invoiceid2,
127
        rrp              => 42
128
    }
123
    }
129
);
124
);
130
125
131
my $invoice1 = GetInvoiceDetails($invoiceid1);
126
$invoice1 = GetInvoiceDetails($invoiceid1);
132
my $invoice2 = GetInvoiceDetails($invoiceid2);
127
$invoice2 = GetInvoiceDetails($invoiceid2);
133
128
134
is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order');
129
is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order');
135
is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders');
130
is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders');
(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (-7 / +6 lines)
Lines 66-72 my $order = Koha::Acquisition::Order->new({ Link Here
66
    basketno => $basketno,
66
    basketno => $basketno,
67
    rrp => $cost,
67
    rrp => $cost,
68
    ecost => $cost,
68
    ecost => $cost,
69
    gstrate => 0.0500,
69
    tax_rate => 0.0500,
70
    orderstatus => 'new',
70
    orderstatus => 'new',
71
    subscriptionid => $subscription->{subscriptionid},
71
    subscriptionid => $subscription->{subscriptionid},
72
    budget_id => $budget_id,
72
    budget_id => $budget_id,
Lines 83-99 ok( $order->{ecost} == $cost, "test cost for the last order not received"); Link Here
83
$dbh->do(q{DELETE FROM aqinvoices});
83
$dbh->do(q{DELETE FROM aqinvoices});
84
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
84
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
85
85
86
my $invoice = GetInvoice( $invoiceid );
87
$invoice->{datereceived} = '02-01-2013';
88
86
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
89
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
87
    {
90
    {
88
        biblionumber     => $biblionumber,
91
        biblionumber     => $biblionumber,
89
        ordernumber      => $ordernumber,
92
        order            => $order,
90
        quantityreceived => 1,
93
        quantityreceived => 1,
91
        cost             => $cost,
92
        ecost            => $cost,
93
        rrp              => $cost,
94
        budget_id        => $budget_id,
94
        budget_id        => $budget_id,
95
        datereceived     => '02-01-2013',
95
        invoice          => $invoice,
96
        invoiceid        => $invoiceid,
97
    }
96
    }
98
);
97
);
99
98
(-)a/t/db_dependent/Acquisition/TransferOrder.t (-2 / +3 lines)
Lines 86-96 $orders = SearchOrders({ ordernumber => $ordernumber }); Link Here
86
is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' );
86
is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' );
87
is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' );
87
is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' );
88
88
89
my $neworder = GetOrder( $newordernumber );
90
89
ModReceiveOrder({
91
ModReceiveOrder({
90
    biblionumber => $biblionumber,
92
    biblionumber => $biblionumber,
91
    ordernumber => $newordernumber,
93
    order       => $neworder,
92
    quantityreceived => 2, 
94
    quantityreceived => 2, 
93
    datereceived => dt_from_string(),
94
});
95
});
95
CancelReceipt( $newordernumber );
96
CancelReceipt( $newordernumber );
96
$order = GetOrder( $newordernumber );
97
$order = GetOrder( $newordernumber );
(-)a/t/db_dependent/Bookseller.t (-9 / +9 lines)
Lines 58-64 my $sample_supplier1 = { Link Here
58
    gstreg        => 1,
58
    gstreg        => 1,
59
    listincgst    => 1,
59
    listincgst    => 1,
60
    invoiceincgst => 1,
60
    invoiceincgst => 1,
61
    gstrate       => '1.0000',
61
    tax_rate       => '1.0000',
62
    discount      => '1.0000',
62
    discount      => '1.0000',
63
    notes         => 'notes1',
63
    notes         => 'notes1',
64
    deliverytime  => undef
64
    deliverytime  => undef
Lines 78-84 my $sample_supplier2 = { Link Here
78
    gstreg        => 1,
78
    gstreg        => 1,
79
    listincgst    => 1,
79
    listincgst    => 1,
80
    invoiceincgst => 1,
80
    invoiceincgst => 1,
81
    gstrate       => '2.0000',
81
    tax_rate       => '2.0000',
82
    discount      => '2.0000',
82
    discount      => '2.0000',
83
    notes         => 'notes2',
83
    notes         => 'notes2',
84
    deliverytime  => 2
84
    deliverytime  => 2
Lines 219-225 $sample_supplier2 = { Link Here
219
    gstreg        => 1,
219
    gstreg        => 1,
220
    listincgst    => 1,
220
    listincgst    => 1,
221
    invoiceincgst => 1,
221
    invoiceincgst => 1,
222
    gstrate       => '2.0000 ',
222
    tax_rate       => '2.0000 ',
223
    discount      => '2.0000',
223
    discount      => '2.0000',
224
    notes         => 'notes2 modified',
224
    notes         => 'notes2 modified',
225
    deliverytime  => 2,
225
    deliverytime  => 2,
Lines 259-265 my $sample_supplier3 = { Link Here
259
    gstreg        => 1,
259
    gstreg        => 1,
260
    listincgst    => 1,
260
    listincgst    => 1,
261
    invoiceincgst => 1,
261
    invoiceincgst => 1,
262
    gstrate       => '3.0000',
262
    tax_rate       => '3.0000',
263
    discount      => '3.0000',
263
    discount      => '3.0000',
264
    notes         => 'notes3',
264
    notes         => 'notes3',
265
    deliverytime  => 3
265
    deliverytime  => 3
Lines 279-285 my $sample_supplier4 = { Link Here
279
    gstreg        => 1,
279
    gstreg        => 1,
280
    listincgst    => 1,
280
    listincgst    => 1,
281
    invoiceincgst => 1,
281
    invoiceincgst => 1,
282
    gstrate       => '3.0000',
282
    tax_rate       => '3.0000',
283
    discount      => '3.0000',
283
    discount      => '3.0000',
284
    notes         => 'notes3',
284
    notes         => 'notes3',
285
};
285
};
Lines 356-362 my $order1 = Koha::Acquisition::Order->new( Link Here
356
        entrydate        => '01-01-2013',
356
        entrydate        => '01-01-2013',
357
        currency         => 'EUR',
357
        currency         => 'EUR',
358
        notes            => "This is a note1",
358
        notes            => "This is a note1",
359
        gstrate          => 0.0500,
359
        tax_rate          => 0.0500,
360
        orderstatus      => 1,
360
        orderstatus      => 1,
361
        subscriptionid   => $id_subscription1,
361
        subscriptionid   => $id_subscription1,
362
        quantityreceived => 2,
362
        quantityreceived => 2,
Lines 376-382 my $order2 = Koha::Acquisition::Order->new( Link Here
376
        entrydate      => '01-01-2013',
376
        entrydate      => '01-01-2013',
377
        currency       => 'EUR',
377
        currency       => 'EUR',
378
        notes          => "This is a note2",
378
        notes          => "This is a note2",
379
        gstrate        => 0.0500,
379
        tax_rate        => 0.0500,
380
        orderstatus    => 1,
380
        orderstatus    => 1,
381
        subscriptionid => $id_subscription2,
381
        subscriptionid => $id_subscription2,
382
        rrp            => 10,
382
        rrp            => 10,
Lines 394-400 my $order3 = Koha::Acquisition::Order->new( Link Here
394
        entrydate      => '02-02-2013',
394
        entrydate      => '02-02-2013',
395
        currency       => 'EUR',
395
        currency       => 'EUR',
396
        notes          => "This is a note3",
396
        notes          => "This is a note3",
397
        gstrate        => 0.0500,
397
        tax_rate        => 0.0500,
398
        orderstatus    => 2,
398
        orderstatus    => 2,
399
        subscriptionid => $id_subscription3,
399
        subscriptionid => $id_subscription3,
400
        rrp            => 11,
400
        rrp            => 11,
Lines 412-418 my $order4 = Koha::Acquisition::Order->new( Link Here
412
        entrydate        => '02-02-2013',
412
        entrydate        => '02-02-2013',
413
        currency         => 'EUR',
413
        currency         => 'EUR',
414
        notes            => "This is a note3",
414
        notes            => "This is a note3",
415
        gstrate          => 0.0500,
415
        tax_rate          => 0.0500,
416
        orderstatus      => 2,
416
        orderstatus      => 2,
417
        subscriptionid   => $id_subscription3,
417
        subscriptionid   => $id_subscription3,
418
        rrp              => 11,
418
        rrp              => 11,
(-)a/t/db_dependent/Budgets.t (-7 / +5 lines)
Lines 310-315 my @order_infos = ( Link Here
310
310
311
my %budgets;
311
my %budgets;
312
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
312
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
313
my $invoice = GetInvoice( $invoiceid );
313
my $item_price = 10;
314
my $item_price = 10;
314
my $item_quantity = 2;
315
my $item_quantity = 2;
315
my $number_of_orders_to_move = 0;
316
my $number_of_orders_to_move = 0;
Lines 330-336 for my $infos (@order_infos) { Link Here
330
                rrp                => $item_price,
331
                rrp                => $item_price,
331
                discount           => 0,
332
                discount           => 0,
332
                uncertainprice     => 0,
333
                uncertainprice     => 0,
333
                gstrate            => 0,
334
                tax_rate            => 0,
334
            }
335
            }
335
        )->insert;
336
        )->insert;
336
        my $ordernumber = $order->{ordernumber};
337
        my $ordernumber = $order->{ordernumber};
Lines 353-371 for my $infos (@order_infos) { Link Here
353
                rrp                => $item_price,
354
                rrp                => $item_price,
354
                discount           => 0,
355
                discount           => 0,
355
                uncertainprice     => 0,
356
                uncertainprice     => 0,
356
                gstrate            => 0,
357
                tax_rate            => 0,
357
            }
358
            }
358
        )->insert;
359
        )->insert;
359
        my $ordernumber = $order->{ordernumber};
360
        my $ordernumber = $order->{ordernumber};
360
        ModReceiveOrder({
361
        ModReceiveOrder({
361
              biblionumber     => $biblionumber,
362
              biblionumber     => $biblionumber,
362
              ordernumber      => $ordernumber,
363
              order            => $order,
363
              budget_id        => $infos->{budget_id},
364
              budget_id        => $infos->{budget_id},
364
              quantityreceived => $item_quantity,
365
              quantityreceived => $item_quantity,
365
              cost             => $item_price,
366
              invoice          => $invoice,
366
              ecost            => $item_price,
367
              invoiceid        => $invoiceid,
368
              rrp              => $item_price,
369
              received_items   => [],
367
              received_items   => [],
370
        } );
368
        } );
371
    }
369
    }
(-)a/t/db_dependent/Serials/Claims.t (-3 / +2 lines)
Lines 46-52 my $sample_supplier1 = { Link Here
46
    gstreg        => 1,
46
    gstreg        => 1,
47
    listincgst    => 1,
47
    listincgst    => 1,
48
    invoiceincgst => 1,
48
    invoiceincgst => 1,
49
    gstrate       => '1.0000',
49
    tax_rate       => '1.0000',
50
    discount      => '1.0000',
50
    discount      => '1.0000',
51
    notes         => 'notes1',
51
    notes         => 'notes1',
52
    deliverytime  => undef
52
    deliverytime  => undef
Lines 66-72 my $sample_supplier2 = { Link Here
66
    gstreg        => 1,
66
    gstreg        => 1,
67
    listincgst    => 1,
67
    listincgst    => 1,
68
    invoiceincgst => 1,
68
    invoiceincgst => 1,
69
    gstrate       => '2.0000',
69
    tax_rate       => '2.0000',
70
    discount      => '2.0000',
70
    discount      => '2.0000',
71
    notes         => 'notes2',
71
    notes         => 'notes2',
72
    deliverytime  => 2
72
    deliverytime  => 2
73
- 

Return to bug 13321