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

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

Return to bug 13321