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

(-)a/C4/Acquisition.pm (-112 / +102 lines)
Lines 1324-1381 sub ModItemOrder { Link Here
1324
1324
1325
=head3 ModReceiveOrder
1325
=head3 ModReceiveOrder
1326
1326
1327
  &ModReceiveOrder({
1327
    my ( $date_received, $new_ordernumber ) = ModReceiveOrder(
1328
    biblionumber => $biblionumber,
1328
        {
1329
    ordernumber => $ordernumber,
1329
            biblionumber         => $biblionumber,
1330
    quantityreceived => $quantityreceived,
1330
            order                => $order,
1331
    user => $user,
1331
            quantityreceived     => $quantityreceived,
1332
    cost => $cost,
1332
            user                 => $user,
1333
    ecost => $ecost,
1333
            invoice              => $invoice,
1334
    invoiceid => $invoiceid,
1334
            budget_id            => $budget_id,
1335
    rrp => $rrp,
1335
            received_itemnumbers => \@received_itemnumbers,
1336
    budget_id => $budget_id,
1336
            order_internalnote   => $order_internalnote,
1337
    datereceived => $datereceived,
1337
        }
1338
    received_itemnumbers => \@received_itemnumbers,
1338
    );
1339
    order_internalnote => $order_internalnote,
1340
    order_vendornote => $order_vendornote,
1341
   });
1342
1339
1343
Updates an order, to reflect the fact that it was received, at least
1340
Updates an order, to reflect the fact that it was received, at least
1344
in part. All arguments not mentioned below update the fields with the
1341
in part.
1345
same name in the aqorders table of the Koha database.
1346
1342
1347
If a partial order is received, splits the order into two.
1343
If a partial order is received, splits the order into two.
1348
1344
1349
Updates the order with bibilionumber C<$biblionumber> and ordernumber
1345
Updates the order with biblionumber C<$biblionumber> and ordernumber
1350
C<$ordernumber>.
1346
C<$order->{ordernumber}>.
1351
1347
1352
=cut
1348
=cut
1353
1349
1354
1350
1355
sub ModReceiveOrder {
1351
sub ModReceiveOrder {
1356
    my ( $params ) = @_;
1352
    my ($params)       = @_;
1357
    my $biblionumber = $params->{biblionumber};
1353
    my $biblionumber   = $params->{biblionumber};
1358
    my $ordernumber = $params->{ordernumber};
1354
    my $order          = { %{ $params->{order} } }; # Copy the order, we don't want to modify it
1359
    my $quantrec = $params->{quantityreceived};
1355
    my $invoice        = $params->{invoice};
1360
    my $user = $params->{user};
1356
    my $quantrec       = $params->{quantityreceived};
1361
    my $cost = $params->{cost};
1357
    my $user           = $params->{user};
1362
    my $ecost = $params->{ecost};
1358
    my $budget_id      = $params->{budget_id};
1363
    my $invoiceid = $params->{invoiceid};
1364
    my $rrp = $params->{rrp};
1365
    my $budget_id = $params->{budget_id};
1366
    my $datereceived = $params->{datereceived};
1367
    my $received_items = $params->{received_items};
1359
    my $received_items = $params->{received_items};
1368
    my $order_internalnote = $params->{order_internalnote};
1369
    my $order_vendornote = $params->{order_vendornote};
1370
1360
1371
    my $dbh = C4::Context->dbh;
1361
    my $dbh = C4::Context->dbh;
1372
    $datereceived = output_pref(
1362
    my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string;
1373
        {
1374
            dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ),
1375
            dateformat => 'iso',
1376
            dateonly => 1,
1377
        }
1378
    );
1379
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1363
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1380
    if ($suggestionid) {
1364
    if ($suggestionid) {
1381
        ModSuggestion( {suggestionid=>$suggestionid,
1365
        ModSuggestion( {suggestionid=>$suggestionid,
Lines 1384-1398 sub ModReceiveOrder { Link Here
1384
                        );
1368
                        );
1385
    }
1369
    }
1386
1370
1387
    my $result_set = $dbh->selectall_arrayref(
1371
    my $new_ordernumber = $order->{ordernumber};
1388
q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?},
1389
        { Slice => {} }, $biblionumber, $ordernumber
1390
    );
1391
1392
    # we assume we have a unique order
1393
    my $order = $result_set->[0];
1394
1395
    my $new_ordernumber = $ordernumber;
1396
    if ( $order->{quantity} > $quantrec ) {
1372
    if ( $order->{quantity} > $quantrec ) {
1397
        # Split order line in two parts: the first is the original order line
1373
        # Split order line in two parts: the first is the original order line
1398
        # without received items (the quantity is decreased),
1374
        # without received items (the quantity is decreased),
Lines 1402-1429 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1402
            UPDATE aqorders
1378
            UPDATE aqorders
1403
            SET quantity = ?,
1379
            SET quantity = ?,
1404
                orderstatus = 'partial'|;
1380
                orderstatus = 'partial'|;
1405
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1381
        $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote};
1406
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1407
        $query .= q| WHERE ordernumber = ?|;
1382
        $query .= q| WHERE ordernumber = ?|;
1408
        my $sth = $dbh->prepare($query);
1383
        my $sth = $dbh->prepare($query);
1409
1384
1410
        $sth->execute(
1385
        $sth->execute(
1411
            $order->{quantity} - $quantrec,
1386
            $order->{quantity} - $quantrec,
1412
            ( defined $order_internalnote ? $order_internalnote : () ),
1387
            ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ),
1413
            ( defined $order_vendornote ? $order_vendornote : () ),
1388
            $order->{ordernumber}
1414
            $ordernumber
1415
        );
1389
        );
1416
1390
1417
        delete $order->{'ordernumber'};
1391
        delete $order->{ordernumber};
1418
        $order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} );
1392
        $order->{budget_id} = ( $budget_id || $order->{budget_id} );
1419
        $order->{'quantity'} = $quantrec;
1393
        $order->{quantity} = $quantrec;
1420
        $order->{'quantityreceived'} = $quantrec;
1394
        $order->{quantityreceived} = $quantrec;
1421
        $order->{'datereceived'} = $datereceived;
1395
        $order->{datereceived} = $datereceived;
1422
        $order->{'invoiceid'} = $invoiceid;
1396
        $order->{invoiceid} = $invoice->{invoiceid};
1423
        $order->{'unitprice'} = $cost;
1397
        $order->{orderstatus} = 'complete';
1424
        $order->{'rrp'} = $rrp;
1425
        $order->{ecost} = $ecost;
1426
        $order->{'orderstatus'} = 'complete';
1427
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1398
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1428
1399
1429
        if ($received_items) {
1400
        if ($received_items) {
Lines 1433-1461 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1433
        }
1404
        }
1434
    } else {
1405
    } else {
1435
        my $query = q|
1406
        my $query = q|
1436
            update aqorders
1407
            UPDATE aqorders
1437
            set quantityreceived=?,datereceived=?,invoiceid=?,
1408
            SET quantityreceived = ?,
1438
                unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete'|;
1409
                datereceived = ?,
1439
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1410
                invoiceid = ?,
1440
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1411
                budget_id = ?,
1412
                orderstatus = 'complete'
1413
        |;
1414
1415
        $query .= q|
1416
            , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ?
1417
        | if defined $order->{unitprice};
1418
1419
        $query .= q|
1420
            , rrp = ?, rrp_tax_included = ?, rrp_tax_excluded = ?
1421
        | if defined $order->{rrp};
1422
1423
        $query .= q|
1424
            , ecost = ?, ecost_tax_included = ?, ecost_tax_excluded = ?
1425
        | if defined $order->{ecost};
1426
1427
        $query .= q|
1428
            , order_internalnote = ?
1429
        | if defined $order->{order_internalnote};
1430
1441
        $query .= q| where biblionumber=? and ordernumber=?|;
1431
        $query .= q| where biblionumber=? and ordernumber=?|;
1432
1442
        my $sth = $dbh->prepare( $query );
1433
        my $sth = $dbh->prepare( $query );
1443
        $sth->execute(
1434
        my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, $budget_id );
1444
            $quantrec,
1435
1445
            $datereceived,
1436
        if ( defined $order->{unitprice} ) {
1446
            $invoiceid,
1437
            push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded};
1447
            $cost,
1438
        }
1448
            $rrp,
1439
        if ( defined $order->{rrp} ) {
1449
            $ecost,
1440
            push @params, $order->{rrp}, $order->{rrp_tax_included}, $order->{rrp_tax_excluded};
1450
            ( $budget_id ? $budget_id : $order->{budget_id} ),
1441
        }
1451
            ( defined $order_internalnote ? $order_internalnote : () ),
1442
        if ( defined $order->{ecost} ) {
1452
            ( defined $order_vendornote ? $order_vendornote : () ),
1443
            push @params, $order->{ecost}, $order->{ecost_tax_included}, $order->{ecost_tax_excluded};
1453
            $biblionumber,
1444
        }
1454
            $ordernumber
1445
        if ( defined $order->{order_internalnote} ) {
1455
        );
1446
            push @params, $order->{order_internalnote};
1447
        }
1448
1449
        push @params, ( $biblionumber, $order->{ordernumber} );
1450
1451
        $sth->execute( @params );
1456
1452
1457
        # All items have been received, sent a notification to users
1453
        # All items have been received, sent a notification to users
1458
        NotifyOrderUsers( $ordernumber );
1454
        NotifyOrderUsers( $order->{ordernumber} );
1459
1455
1460
    }
1456
    }
1461
    return ($datereceived, $new_ordernumber);
1457
    return ($datereceived, $new_ordernumber);
Lines 2830-2879 sub populate_order_with_prices { Link Here
2830
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2826
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2831
    if ($ordering) {
2827
    if ($ordering) {
2832
        if ( $bookseller->{listincgst} ) {
2828
        if ( $bookseller->{listincgst} ) {
2833
            $order->{rrpgsti} = $order->{rrp};
2829
            $order->{rrp_tax_included} = $order->{rrp};
2834
            $order->{rrpgste} = Koha::Number::Price->new(
2830
            $order->{rrp_tax_excluded} = Koha::Number::Price->new(
2835
                $order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round;
2831
                $order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2836
            $order->{ecostgsti} = $order->{ecost};
2832
            $order->{ecost_tax_included} = $order->{ecost};
2837
            $order->{ecostgste} = Koha::Number::Price->new(
2833
            $order->{ecost_tax_excluded} = Koha::Number::Price->new(
2838
                $order->{ecost} / ( 1 + $order->{gstrate} ) )->round;
2834
                $order->{ecost} / ( 1 + $order->{tax_rate} ) )->round;
2839
            $order->{gstvalue} = Koha::Number::Price->new(
2835
            $order->{tax_value} = Koha::Number::Price->new(
2840
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2836
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2841
                  $order->{quantity} )->round;
2837
                  $order->{quantity} )->round;
2842
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2843
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2844
        }
2838
        }
2845
        else {
2839
        else {
2846
            $order->{rrpgste} = $order->{rrp};
2840
            $order->{rrp_tax_excluded} = $order->{rrp};
2847
            $order->{rrpgsti} = Koha::Number::Price->new(
2841
            $order->{rrp_tax_included} = Koha::Number::Price->new(
2848
                $order->{rrp} * ( 1 + $order->{gstrate} ) )->round;
2842
                $order->{rrp} * ( 1 + $order->{tax_rate} ) )->round;
2849
            $order->{ecostgste} = $order->{ecost};
2843
            $order->{ecost_tax_excluded} = $order->{ecost};
2850
            $order->{ecostgsti} = Koha::Number::Price->new(
2844
            $order->{ecost_tax_included} = Koha::Number::Price->new(
2851
                $order->{ecost} * ( 1 + $order->{gstrate} ) )->round;
2845
                $order->{ecost} * ( 1 + $order->{tax_rate} ) )->round;
2852
            $order->{gstvalue} = Koha::Number::Price->new(
2846
            $order->{tax_value} = Koha::Number::Price->new(
2853
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2847
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2854
                  $order->{quantity} )->round;
2848
                  $order->{quantity} )->round;
2855
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2856
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2857
        }
2849
        }
2858
    }
2850
    }
2859
2851
2860
    if ($receiving) {
2852
    if ($receiving) {
2861
        if ( $bookseller->{listincgst} ) {
2853
        if ( $bookseller->{listincgst} ) {
2862
            $order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round;
2854
            $order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round;
2863
            $order->{unitpricegste} = Koha::Number::Price->new(
2855
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new(
2864
              $order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round;
2856
              $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2865
        }
2857
        }
2866
        else {
2858
        else {
2867
            $order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round;
2859
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round;
2868
            $order->{unitpricegsti} = Koha::Number::Price->new(
2860
            $order->{unitprice_tax_included} = Koha::Number::Price->new(
2869
              $order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round;
2861
              $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round;
2870
        }
2862
        }
2871
        $order->{gstvalue} = Koha::Number::Price->new(
2863
        $order->{tax_value} = Koha::Number::Price->new(
2872
          ( $order->{unitpricegsti} - $order->{unitpricegste} )
2864
          ( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} )
2873
          * $order->{quantityreceived} )->round;
2865
          * $order->{quantityreceived} )->round;
2874
2866
2875
        $order->{totalgste} = $order->{unitpricegste} * $order->{quantity};
2876
        $order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity};
2877
    }
2867
    }
2878
2868
2879
    return $order;
2869
    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 308-334 elsif ( $op eq 'ediorder' ) { Link Here
308
    my @book_foot_loop;
308
    my @book_foot_loop;
309
    my %foot;
309
    my %foot;
310
    my $total_quantity = 0;
310
    my $total_quantity = 0;
311
    my $total_gste = 0;
311
    my $total_tax_excluded = 0;
312
    my $total_gsti = 0;
312
    my $total_tax_included = 0;
313
    my $total_gstvalue = 0;
313
    my $total_tax_value = 0;
314
    for my $order (@orders) {
314
    for my $order (@orders) {
315
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
316
        my $line = get_order_infos( $order, $bookseller);
315
        my $line = get_order_infos( $order, $bookseller);
317
        if ( $line->{uncertainprice} ) {
316
        if ( $line->{uncertainprice} ) {
318
            $template->param( uncertainprices => 1 );
317
            $template->param( uncertainprices => 1 );
319
        }
318
        }
320
319
320
        $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format;
321
        $line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format;
322
321
        push @books_loop, $line;
323
        push @books_loop, $line;
322
324
323
        $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
325
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
324
        $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
326
        $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
325
        $total_gstvalue += $$line{gstvalue};
327
        $total_tax_value += $$line{tax_value};
326
        $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
328
        $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
327
        $total_quantity += $$line{quantity};
329
        $total_quantity += $$line{quantity};
328
        $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
330
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
329
        $total_gste += $$line{totalgste};
331
        $total_tax_excluded += $$line{total_tax_excluded};
330
        $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
332
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
331
        $total_gsti += $$line{totalgsti};
333
        $total_tax_included += $$line{total_tax_included};
332
    }
334
    }
333
335
334
    push @book_foot_loop, map {$_} values %foot;
336
    push @book_foot_loop, map {$_} values %foot;
Lines 337-343 elsif ( $op eq 'ediorder' ) { Link Here
337
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
339
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
338
    my @cancelledorders_loop;
340
    my @cancelledorders_loop;
339
    for my $order (@cancelledorders) {
341
    for my $order (@cancelledorders) {
340
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
341
        my $line = get_order_infos( $order, $bookseller);
342
        my $line = get_order_infos( $order, $bookseller);
342
        push @cancelledorders_loop, $line;
343
        push @cancelledorders_loop, $line;
343
    }
344
    }
Lines 389-397 elsif ( $op eq 'ediorder' ) { Link Here
389
        book_foot_loop       => \@book_foot_loop,
390
        book_foot_loop       => \@book_foot_loop,
390
        cancelledorders_loop => \@cancelledorders_loop,
391
        cancelledorders_loop => \@cancelledorders_loop,
391
        total_quantity       => $total_quantity,
392
        total_quantity       => $total_quantity,
392
        total_gste           => sprintf( "%.2f", $total_gste ),
393
        total_tax_excluded   => $total_tax_excluded,
393
        total_gsti           => sprintf( "%.2f", $total_gsti ),
394
        total_tax_included   => $total_tax_included,
394
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
395
        total_tax_value      => $total_tax_value,
395
        currency             => $active_currency->currency,
396
        currency             => $active_currency->currency,
396
        listincgst           => $bookseller->{listincgst},
397
        listincgst           => $bookseller->{listincgst},
397
        basketgroups         => $basketgroups,
398
        basketgroups         => $basketgroups,
Lines 418-424 sub get_order_infos { Link Here
418
    $line{budget_name}    = $budget->{budget_name};
419
    $line{budget_name}    = $budget->{budget_name};
419
420
420
    if ( $line{uncertainprice} ) {
421
    if ( $line{uncertainprice} ) {
421
        $line{rrpgste} .= ' (Uncertain)';
422
        $line{rrp_tax_excluded} .= ' (Uncertain)';
422
    }
423
    }
423
    if ( $line{'title'} ) {
424
    if ( $line{'title'} ) {
424
        my $volume      = $order->{'volume'};
425
        my $volume      = $order->{'volume'};
(-)a/acqui/basketgroup.pl (-6 / +13 lines)
Lines 75-83 sub BasketTotal { Link Here
75
    my $total = 0;
75
    my $total = 0;
76
    my @orders = GetOrders($basketno);
76
    my @orders = GetOrders($basketno);
77
    for my $order (@orders){
77
    for my $order (@orders){
78
        $total = $total + ( $order->{ecost} * $order->{quantity} );
78
        # FIXME The following is wrong
79
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) {
79
        if ( $bookseller->{listincgst} ) {
80
            my $gst = $bookseller->{gstrate} // C4::Context->preference("gist");
80
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
81
        } else {
82
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
83
        }
84
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{tax_rate} // C4::Context->preference("gist") )) {
85
            my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist");
81
            $total = $total * ( $gst / 100 +1);
86
            $total = $total * ( $gst / 100 +1);
82
        }
87
        }
83
    }
88
    }
Lines 168-180 sub printbasketgrouppdf{ Link Here
168
                croak $@;
173
                croak $@;
169
            }
174
            }
170
175
171
            $ord = C4::Acquisition::populate_order_with_prices({ order => $ord, booksellerid => $bookseller->{id}, ordering => 1 });
176
            $ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity};
177
            $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
178
172
            my $bib = GetBiblioData($ord->{biblionumber});
179
            my $bib = GetBiblioData($ord->{biblionumber});
173
            my $itemtypes = GetItemTypes();
180
            my $itemtypes = GetItemTypes();
174
181
175
            #FIXME DELETE ME
182
            #FIXME DELETE ME
176
            # 0      1        2        3         4            5         6       7      8        9
183
            # 0      1        2        3         4            5         6       7      8        9
177
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate
184
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount tax_rate
178
185
179
            # Editor Number
186
            # Editor Number
180
            my $en;
187
            my $en;
Lines 202-208 sub printbasketgrouppdf{ Link Here
202
        -type       => 'application/pdf',
209
        -type       => 'application/pdf',
203
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
210
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
204
    );
211
    );
205
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed";
212
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed";
206
    print $pdf;
213
    print $pdf;
207
214
208
}
215
}
(-)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 116-143 my $orders = $details->{'orders'}; Link Here
116
my @foot_loop;
116
my @foot_loop;
117
my %foot;
117
my %foot;
118
my $total_quantity = 0;
118
my $total_quantity = 0;
119
my $total_gste = 0;
119
my $total_tax_excluded = 0;
120
my $total_gsti = 0;
120
my $total_tax_included = 0;
121
my $total_gstvalue = 0;
121
my $total_tax_value = 0;
122
foreach my $order (@$orders) {
122
foreach my $order (@$orders) {
123
    $order = C4::Acquisition::populate_order_with_prices(
124
        {
125
            order        => $order,
126
            booksellerid => $bookseller->{id},
127
            receiving    => 1,
128
        }
129
    );
130
    my $line = get_infos( $order, $bookseller);
123
    my $line = get_infos( $order, $bookseller);
131
124
132
    $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
125
    $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format;
133
    $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
126
    $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format;
134
    $total_gstvalue += $$line{gstvalue};
127
135
    $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
128
    $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
129
    $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
130
    $total_tax_value += $$line{tax_value};
131
    $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
136
    $total_quantity += $$line{quantity};
132
    $total_quantity += $$line{quantity};
137
    $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
133
    $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
138
    $total_gste += $$line{totalgste};
134
    $total_tax_excluded += $$line{total_tax_excluded};
139
    $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
135
    $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
140
    $total_gsti += $$line{totalgsti};
136
    $total_tax_included += $$line{total_tax_included};
141
137
142
    $line->{orderline} = $line->{parent_ordernumber};
138
    $line->{orderline} = $line->{parent_ordernumber};
143
    push @orders_loop, $line;
139
    push @orders_loop, $line;
Lines 172-182 $template->param( Link Here
172
    orders_loop      => \@orders_loop,
168
    orders_loop      => \@orders_loop,
173
    foot_loop        => \@foot_loop,
169
    foot_loop        => \@foot_loop,
174
    total_quantity   => $total_quantity,
170
    total_quantity   => $total_quantity,
175
    total_gste       => sprintf( $format, $total_gste ),
171
    total_tax_excluded       => sprintf( $format, $total_tax_excluded ),
176
    total_gsti       => sprintf( $format, $total_gsti ),
172
    total_tax_included       => sprintf( $format, $total_tax_included ),
177
    total_gstvalue   => sprintf( $format, $total_gstvalue ),
173
    total_tax_value   => sprintf( $format, $total_tax_value ),
178
    total_gste_shipment => sprintf( $format, $total_gste + $details->{shipmentcost}),
174
    total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}),
179
    total_gsti_shipment => sprintf( $format, $total_gsti + $details->{shipmentcost}),
175
    total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}),
180
    invoiceincgst    => $bookseller->{invoiceincgst},
176
    invoiceincgst    => $bookseller->{invoiceincgst},
181
    currency         => Koha::Acquisition::Currencies->get_active,
177
    currency         => Koha::Acquisition::Currencies->get_active,
182
    budgets_loop     => \@budgets_loop,
178
    budgets_loop     => \@budgets_loop,
(-)a/acqui/neworderempty.pl (-2 / +2 lines)
Lines 284-290 if ( defined $subscriptionid ) { Link Here
284
        $budget_id              = $lastOrderReceived->{budgetid};
284
        $budget_id              = $lastOrderReceived->{budgetid};
285
        $data->{listprice}      = $lastOrderReceived->{listprice};
285
        $data->{listprice}      = $lastOrderReceived->{listprice};
286
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
286
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
287
        $data->{gstrate}        = $lastOrderReceived->{gstrate};
287
        $data->{tax_rate}        = $lastOrderReceived->{tax_rate};
288
        $data->{discount}       = $lastOrderReceived->{discount};
288
        $data->{discount}       = $lastOrderReceived->{discount};
289
        $data->{rrp}            = $lastOrderReceived->{rrp};
289
        $data->{rrp}            = $lastOrderReceived->{rrp};
290
        $data->{ecost}          = $lastOrderReceived->{ecost};
290
        $data->{ecost}          = $lastOrderReceived->{ecost};
Lines 368-374 $template->param( Link Here
368
    quantityrec      => $quantity,
368
    quantityrec      => $quantity,
369
    rrp              => $data->{'rrp'},
369
    rrp              => $data->{'rrp'},
370
    gst_values       => \@gst_values,
370
    gst_values       => \@gst_values,
371
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
371
    tax_rate          => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
372
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
372
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
373
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
373
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
374
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
374
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
(-)a/acqui/orderreceive.pl (-6 / +6 lines)
Lines 169-183 if ( $bookseller->{listincgst} ) { Link Here
169
        $ecost = $order->{ecost};
169
        $ecost = $order->{ecost};
170
        $unitprice = $order->{unitprice};
170
        $unitprice = $order->{unitprice};
171
    } else {
171
    } else {
172
        $rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
172
        $rrp = $order->{rrp} / ( 1 + $order->{tax_rate} );
173
        $ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
173
        $ecost = $order->{ecost} / ( 1 + $order->{tax_rate} );
174
        $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
174
        $unitprice = $order->{unitprice} / ( 1 + $order->{tax_rate} );
175
    }
175
    }
176
} else {
176
} else {
177
    if ( $bookseller->{invoiceincgst} ) {
177
    if ( $bookseller->{invoiceincgst} ) {
178
        $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
178
        $rrp = $order->{rrp} * ( 1 + $order->{tax_rate} );
179
        $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
179
        $ecost = $order->{ecost} * ( 1 + $order->{tax_rate} );
180
        $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
180
        $unitprice = $order->{unitprice} * ( 1 + $order->{tax_rate} );
181
    } else {
181
    } else {
182
        $rrp = $order->{rrp};
182
        $rrp = $order->{rrp};
183
        $ecost = $order->{ecost};
183
        $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 11-22 Link Here
11
//<![CDATA[
11
//<![CDATA[
12
    function updateColumnsVisibility(visible) {
12
    function updateColumnsVisibility(visible) {
13
        if ( visible ) {
13
        if ( visible ) {
14
            $("table .gste, .gsti").show();
14
            $("table .tax_excluded, .tax_included").show();
15
        } else {
15
        } else {
16
            [% IF ( listincgst ) %]
16
            [% IF ( listincgst ) %]
17
                $("table .gste").hide();
17
                $("table .tax_excluded").hide();
18
            [% ELSE %]
18
            [% ELSE %]
19
                $("table .gsti").hide();
19
                $("table .tax_included").hide();
20
            [% END %]
20
            [% END %]
21
        }
21
        }
22
    }
22
    }
Lines 392-404 Link Here
392
                    <tr>
392
                    <tr>
393
                        <th>No.</th>
393
                        <th>No.</th>
394
                        <th>Order</th>
394
                        <th>Order</th>
395
                        <th class="gste">RRP tax exc.</th>
395
                        <th class="tax_excluded">RRP tax exc.</th>
396
                        <th class="gste">ecost tax exc.</th>
396
                        <th class="tax_excluded">ecost tax exc.</th>
397
                        <th class="gsti">RRP tax inc.</th>
397
                        <th class="tax_included">RRP tax inc.</th>
398
                        <th class="gsti">ecost tax inc.</th>
398
                        <th class="tax_included">ecost tax inc.</th>
399
                        <th>Qty.</th>
399
                        <th>Qty.</th>
400
                        <th class="gste">Total tax exc. ([% currency %])</th>
400
                        <th class="tax_excluded">Total tax exc. ([% currency %])</th>
401
                        <th class="gsti">Total tax inc. ([% currency %])</th>
401
                        <th class="tax_included">Total tax inc. ([% currency %])</th>
402
                        <th>GST %</th>
402
                        <th>GST %</th>
403
                        <th>GST</th>
403
                        <th>GST</th>
404
                        <th>Fund</th>
404
                        <th>Fund</th>
Lines 415-430 Link Here
415
                [% FOREACH foot_loo IN book_foot_loop %]
415
                [% FOREACH foot_loo IN book_foot_loop %]
416
                    <tr>
416
                    <tr>
417
                        <th></th>
417
                        <th></th>
418
                        <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
418
                        <th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
419
                        <th class="gste">&nbsp;</th>
419
                        <th class="tax_excluded">&nbsp;</th>
420
                        <th class="gste">&nbsp;</th>
420
                        <th class="tax_excluded">&nbsp;</th>
421
                        <th class="gsti">&nbsp;</th>
421
                        <th class="tax_included">&nbsp;</th>
422
                        <th class="gsti">&nbsp;</th>
422
                        <th class="tax_included">&nbsp;</th>
423
                        <th>[% foot_loo.quantity %]</th>
423
                        <th>[% foot_loo.quantity %]</th>
424
                        <th class="gste">[% foot_loo.totalgste | $Price%]</th>
424
                        <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
425
                        <th class="gsti">[% foot_loo.totalgsti | $Price %]</th>
425
                        <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
426
                        <th>&nbsp;</th>
426
                        <th>&nbsp;</th>
427
                        <th>[% foot_loo.gstvalue | $Price %]</th>
427
                        <th>[% foot_loo.tax_value | $Price %]</th>
428
                        <th>&nbsp;</th>
428
                        <th>&nbsp;</th>
429
                        <th>&nbsp;</th>
429
                        <th>&nbsp;</th>
430
                        [% IF ( active ) %]
430
                        [% IF ( active ) %]
Lines 438-452 Link Here
438
                <tr>
438
                <tr>
439
                    <th></th>
439
                    <th></th>
440
                    <th>Total ([% currency %])</th>
440
                    <th>Total ([% currency %])</th>
441
                    <th class="gste">&nbsp;</th>
441
                    <th class="tax_excluded">&nbsp;</th>
442
                    <th class="gste">&nbsp;</th>
442
                    <th class="tax_excluded">&nbsp;</th>
443
                    <th class="gsti">&nbsp;</th>
443
                    <th class="tax_included">&nbsp;</th>
444
                    <th class="gsti">&nbsp;</th>
444
                    <th class="tax_included">&nbsp;</th>
445
                    <th>[% total_quantity %]</th>
445
                    <th>[% total_quantity %]</th>
446
                    <th class="gste">[% total_gste | $Price %]</th>
446
                    <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
447
                    <th class="gsti">[% total_gsti | $Price %]</th>
447
                    <th class="tax_included">[% total_tax_included | $Price %]</th>
448
                    <th>&nbsp;</th>
448
                    <th>&nbsp;</th>
449
                    <th>[% total_gstvalue | $Price %]</th>
449
                    <th>[% total_tax_value | $Price %]</th>
450
                    <th>&nbsp;</th>
450
                    <th>&nbsp;</th>
451
                    <th>&nbsp;</th>
451
                    <th>&nbsp;</th>
452
                    [% IF ( active ) %]
452
                    [% IF ( active ) %]
Lines 512-526 Link Here
512
                        </td>
512
                        </td>
513
                        [% 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 ... %]
513
                        [% 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 ... %]
514
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
514
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
515
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
515
                        <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
516
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
516
                        <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
517
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
517
                        <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
518
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
518
                        <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
519
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
519
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
520
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
520
                        <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
521
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
521
                        <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
522
                        <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
522
                        <td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
523
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
523
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
524
                        <td>[% books_loo.budget_name %]</td>
524
                        <td>[% books_loo.budget_name %]</td>
525
                        <td>[% books_loo.suppliers_report %]</td>
525
                        <td>[% books_loo.suppliers_report %]</td>
526
                        [% IF ( active ) %]
526
                        [% IF ( active ) %]
Lines 574-586 Link Here
574
                <tr>
574
                <tr>
575
                  <th>No.</th>
575
                  <th>No.</th>
576
                  <th>Order</th>
576
                  <th>Order</th>
577
                  <th class="gste">RRP tax exc.</th>
577
                  <th class="tax_excluded">RRP tax exc.</th>
578
                  <th class="gste">ecost tax exc.</th>
578
                  <th class="tax_excluded">ecost tax exc.</th>
579
                  <th class="gsti">RRP tax inc.</th>
579
                  <th class="tax_included">RRP tax inc.</th>
580
                  <th class="gsti">ecost tax inc.</th>
580
                  <th class="tax_included">ecost tax inc.</th>
581
                  <th>Qty.</th>
581
                  <th>Qty.</th>
582
                  <th class="gste">Total tax exc. ([% currency %])</th>
582
                  <th class="tax_excluded">Total tax exc. ([% currency %])</th>
583
                  <th class="gsti">Total tax inc. ([% currency %])</th>
583
                  <th class="tax_included">Total tax inc. ([% currency %])</th>
584
                  <th>GST %</th>
584
                  <th>GST %</th>
585
                  <th>GST</th>
585
                  <th>GST</th>
586
                  <th>Fund</th>
586
                  <th>Fund</th>
Lines 625-639 Link Here
625
                        </p>
625
                        </p>
626
                      [% END %]
626
                      [% END %]
627
                    </td>
627
                    </td>
628
                    <td class="number gste">[% order.rrpgste | $Price %]</td>
628
                    <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
629
                    <td class="number gste">[% order.ecostgste | $Price %]</td>
629
                    <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
630
                    <td class="number gsti">[% order.rrpgsti | $Price %]</td>
630
                    <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
631
                    <td class="number gsti">[% order.ecostgsti | $Price %]</td>
631
                    <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
632
                    <td class="number">[% order.quantity %]</td>
632
                    <td class="number">[% order.quantity %]</td>
633
                    <td class="number gste">[% order.totalgste | $Price %]</td>
633
                    <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
634
                    <td class="number gsti">[% order.totalgsti | $Price %]</td>
634
                    <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
635
                    <td class="number">[% order.gstrate * 100 | $Price %]</td>
635
                    <td class="number">[% order.tax_rate * 100 | $Price %]</td>
636
                    <td class="number">[% order.gstvalue | $Price %]</td>
636
                    <td class="number">[% order.tax_value | $Price %]</td>
637
                    <td>[% order.budget_name %]
637
                    <td>[% order.budget_name %]
638
                  </tr>
638
                  </tr>
639
                [% END %]
639
                [% 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 133-143 Link Here
133
              <tr>
133
              <tr>
134
                <th>Summary</th>
134
                <th>Summary</th>
135
                <th>Library</th>
135
                <th>Library</th>
136
                <th class="gste">Actual cost tax exc.</th>
136
                <th class="tax_excluded">Actual cost tax exc.</th>
137
                <th class="gsti">Actual cost tax inc.</th>
137
                <th class="tax_included">Actual cost tax inc.</th>
138
                <th>Qty.</th>
138
                <th>Qty.</th>
139
                <th class="gste">Total tax exc. ([% currency.symbol %])</th>
139
                <th class="tax_excluded">Total tax exc. ([% currency.symbol %])</th>
140
                <th class="gsti">Total tax inc. ([% currency.symbol %])</th>
140
                <th class="tax_included">Total tax inc. ([% currency.symbol %])</th>
141
                <th>GST %</th>
141
                <th>GST %</th>
142
                <th>GST</th>
142
                <th>GST</th>
143
                <th>Fund</th>
143
                <th>Fund</th>
Lines 165-177 Link Here
165
                    [% END %]
165
                    [% END %]
166
                  </td>
166
                  </td>
167
                  <td><p>[% order.branchcode %]</p></td>
167
                  <td><p>[% order.branchcode %]</p></td>
168
                  <td class="number gste">[% order.unitpricegste | $Price %]</td>
168
                  <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
169
                  <td class="number gsti">[% order.unitpricegsti | $Price %]</td>
169
                  <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
170
                  <td class="number">[% order.quantity %]</td>
170
                  <td class="number">[% order.quantity %]</td>
171
                  <td class="number gste">[% order.totalgste | $Price %]</td>
171
                  <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
172
                  <td class="number gsti">[% order.totalgsti | $Price %]</td>
172
                  <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
173
                  <td class="number">[% order.gstrate * 100 | $Price %]</td>
173
                  <td class="number">[% order.tax_rate * 100 | $Price %]</td>
174
                  <td class="number">[% order.gstvalue | $Price %]</td>
174
                  <td class="number">[% order.tax_value | $Price %]</td>
175
                  <td>[% order.budget_name %]</td>
175
                  <td>[% order.budget_name %]</td>
176
                </tr>
176
                </tr>
177
              [% END %]
177
              [% END %]
Lines 179-213 Link Here
179
            <tfoot>
179
            <tfoot>
180
              [% FOR tf IN foot_loop %]
180
              [% FOR tf IN foot_loop %]
181
                <tr>
181
                <tr>
182
                    <th colspan='2'>Total (GST [% tf.gstrate * 100 | $Price %] %)</th>
182
                    <th colspan='3'>Total (GST [% tf.tax_rate * 100 | $Price %] %)</th>
183
                    <th class="gste"/><th class="gsti"/>
183
                    <th class="tax_excluded"/><th class="tax_included"/>
184
                    <th>[% tf.quantity %]</th>
184
                    <th>[% tf.quantity %]</th>
185
                    <th class="gste">[% tf.totalgste | $Price %]</th>
185
                    <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
186
                    <th class="gsti">[% tf.totalgsti | $Price %]</th>
186
                    <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
187
                    <th>&nbsp;</th>
187
                    <th>&nbsp;</th>
188
                    <th>[% tf.gstvalue | $Price %]</th>
188
                    <th>[% tf.tax_value | $Price %]</th>
189
                    <th>&nbsp;</th>
189
                    <th>&nbsp;</th>
190
                </tr>
190
                </tr>
191
              [% END %]
191
              [% END %]
192
              <tr>
192
              <tr>
193
                <th colspan='2'>Total ([% currency.symbol %])</th>
193
                <th colspan='2'>Total ([% currency.symbol %])</th>
194
                <th class="gste"/><th class="gsti"/>
194
                <th class="tax_excluded"/><th class="tax_included"/>
195
                <th>[% total_quantity %]</th>
195
                <th>[% total_quantity %]</th>
196
                <th class="gste">[% total_gste | $Price %]</th>
196
                <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
197
                <th class="gsti">[% total_gsti | $Price %]</th>
197
                <th class="tax_included">[% total_tax_included | $Price %]</th>
198
                <th>&nbsp;</th>
198
                <th>&nbsp;</th>
199
                <th>[% total_gstvalue | $Price %]</th>
199
                <th>[% total_tax_value | $Price %]</th>
200
                <th>&nbsp;</th>
200
                <th>&nbsp;</th>
201
              </tr>
201
              </tr>
202
              <tr>
202
              <tr>
203
                <th colspan="2">Total + Shipment cost ([% currency.symbol %])</th>
203
                <th colspan="2">Total + Shipment cost ([% currency.symbol %])</th>
204
                <th class="gste"></th>
204
                <th class="tax_excluded"></th>
205
                <th class="gsti"></th>
205
                <th class="tax_included"></th>
206
                <th>[% total_quantity %]</th>
206
                <th>[% total_quantity %]</th>
207
                <th class="gste">[% total_gste_shipment | $Price %]</th>
207
                <th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th>
208
                <th class="gsti">[% total_gsti_shipment | $Price %]</th>
208
                <th class="tax_included">[% total_tax_included_shipment | $Price %]</th>
209
                <th>&nbsp;</th>
209
                <th>&nbsp;</th>
210
                <th>[% total_gstvalue | $Price %]</th>
210
                <th>[% total_tax_value | $Price %]</th>
211
                <th>&nbsp;</th>
211
                <th>&nbsp;</th>
212
              </tr>
212
              </tr>
213
            </tfoot>
213
            </tfoot>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-5 / +5 lines)
Lines 556-567 $(document).ready(function() Link Here
556
                <li>
556
                <li>
557
                    [% IF ( close ) %]
557
                    [% IF ( close ) %]
558
                        <span class="label">Tax rate: </span>
558
                        <span class="label">Tax rate: </span>
559
                        <input type="hidden" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
559
                        <input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate %]" />[% tax_rate %]%
560
                    [% ELSE %]
560
                    [% ELSE %]
561
                        <label for="gstrate">Tax rate: </label>
561
                        <label for="tax_rate">Tax rate: </label>
562
                        <select name="gstrate" id="gstrate" onchange="updateCosts();">
562
                        <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
563
                        [% FOREACH gst IN gst_values %]
563
                        [% FOREACH gst IN gst_values %]
564
                          [% IF ( gst.option == gstrate ) %]
564
                          [% IF ( gst.option == tax_rate ) %]
565
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
565
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
566
                          [% ELSE %]
566
                          [% ELSE %]
567
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
567
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
Lines 570-576 $(document).ready(function() Link Here
570
                        </select>
570
                        </select>
571
                    [% END %]
571
                    [% END %]
572
                [% ELSE %]
572
                [% ELSE %]
573
                    <input type="hidden" name="gstrate" value="0" />
573
                    <input type="hidden" name="tax_rate" value="0" />
574
                </li>
574
                </li>
575
            [% END %]
575
            [% END %]
576
            <li>
576
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-1 / +1 lines)
Lines 261-267 Link Here
261
    <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
261
    <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
262
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
262
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
263
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
263
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
264
    <input type="hidden" name="gstrate" value="[% gstrate %]" />
264
    <input type="hidden" name="tax_rate" value="[% tax_rate %]" />
265
	</div>
265
	</div>
266
	<div class="yui-u">
266
	<div class="yui-u">
267
    <fieldset class="rows">
267
    <fieldset class="rows">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-4 / +4 lines)
Lines 361-379 Link Here
361
        [% END %]
361
        [% END %]
362
        <tr>
362
        <tr>
363
            <th colspan="10" class="total">Total tax exc.</th>
363
            <th colspan="10" class="total">Total tax exc.</th>
364
            <th>[% total_gste | $Price %]</th>
364
            <th>[% total_tax_excluded | $Price %]</th>
365
            <th></th>
365
            <th></th>
366
        </tr>
366
        </tr>
367
        [% FOREACH book_foot IN book_foot_loop %]
367
        [% FOREACH book_foot IN book_foot_loop %]
368
            <tr>
368
            <tr>
369
                <th colspan="10">Total (GST [% book_foot.gstrate * 100 | $Price %]%)</th>
369
                <th colspan="10">Total (GST [% book_foot.tax_rate * 100 | $Price %]%)</th>
370
                <th>[% book_foot.gstvalue | $Price %]</th>
370
                <th>[% book_foot.tax_value | $Price %]</th>
371
                <th></th>
371
                <th></th>
372
            </tr>
372
            </tr>
373
        [% END %]
373
        [% END %]
374
        <tr>
374
        <tr>
375
            <th colspan="10" class="total">Total tax inc.</th>
375
            <th colspan="10" class="total">Total tax inc.</th>
376
            <th>[% total_gsti | $Price %]</th>
376
            <th>[% total_tax_included | $Price %]</th>
377
            <th></th>
377
            <th></th>
378
        </tr>
378
        </tr>
379
    </tfoot>
379
    </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 352-359 $(document).ready(function() { Link Here
352
                <tbody>
352
                <tbody>
353
                    <tr>
353
                    <tr>
354
                        <td>Ordered amount</td>
354
                        <td>Ordered amount</td>
355
                        <td>[% valuegste_ordered %]</td>
355
                        <td>[% value_tax_excluded_ordered %]</td>
356
                        <td>[% valuegsti_ordered %]</td>
356
                        <td>[% value_tax_included_ordered %]</td>
357
                        <td>[% budget_name_ordered %]</td>
357
                        <td>[% budget_name_ordered %]</td>
358
                        <td>
358
                        <td>
359
                            [% IF ( ordered_exists ) %]
359
                            [% IF ( ordered_exists ) %]
Lines 363-370 $(document).ready(function() { Link Here
363
                    </tr>
363
                    </tr>
364
                    <tr>
364
                    <tr>
365
                        <td>Spent amount</td>
365
                        <td>Spent amount</td>
366
                        <td>[% valuegste_spent %]</td>
366
                        <td>[% value_tax_excluded_spent %]</td>
367
                        <td>[% valuegsti_spent %]</td>
367
                        <td>[% value_tax_included_spent %]</td>
368
                        <td>[% budget_name_spent %]</td>
368
                        <td>[% budget_name_spent %]</td>
369
                        <td>
369
                        <td>
370
                            [% IF ( spent_exists ) %]
370
                            [% 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 59-65 for my $currency_format ( qw( US FR ) ) { Link Here
59
            invoiceid        => $invoiceid_0_0,
59
            invoiceid        => $invoiceid_0_0,
60
            rrp              => 82.00,
60
            rrp              => 82.00,
61
            ecost            => 73.80,
61
            ecost            => 73.80,
62
            gstrate          => 0.0500,
62
            tax_rate         => 0.0500,
63
            discount         => 10.0000,
63
            discount         => 10.0000,
64
            datereceived     => $today
64
            datereceived     => $today
65
        };
65
        };
Lines 74-131 for my $currency_format ( qw( US FR ) ) { Link Here
74
        # Note that this configuration is correct \o/
74
        # Note that this configuration is correct \o/
75
        compare(
75
        compare(
76
            {
76
            {
77
                got      => $order_0_0->{rrpgsti},
77
                got      => $order_0_0->{rrp_tax_included},
78
                expected => 86.10,
78
                expected => 86.10,
79
                conf     => '0 0',
79
                conf     => '0 0',
80
                field    => 'rrpgsti'
80
                field    => 'rrp_tax_included'
81
            }
81
            }
82
        );
82
        );
83
        compare(
83
        compare(
84
            {
84
            {
85
                got      => $order_0_0->{rrpgste},
85
                got      => $order_0_0->{rrp_tax_excluded},
86
                expected => 82.00,
86
                expected => 82.00,
87
                conf     => '0 0',
87
                conf     => '0 0',
88
                field    => 'rrpgste'
88
                field    => 'rrp_tax_excluded'
89
            }
89
            }
90
        );
90
        );
91
        compare(
91
        compare(
92
            {
92
            {
93
                got      => $order_0_0->{ecostgsti},
93
                got      => $order_0_0->{ecost_tax_included},
94
                expected => 77.49,
94
                expected => 77.49,
95
                conf     => '0 0',
95
                conf     => '0 0',
96
                field    => 'ecostgsti'
96
                field    => 'ecost_tax_included'
97
            }
97
            }
98
        );
98
        );
99
        compare(
99
        compare(
100
            {
100
            {
101
                got      => $order_0_0->{ecostgste},
101
                got      => $order_0_0->{ecost_tax_excluded},
102
                expected => 73.80,
102
                expected => 73.80,
103
                conf     => '0 0',
103
                conf     => '0 0',
104
                field    => 'ecostgste'
104
                field    => 'ecost_tax_excluded'
105
            }
105
            }
106
        );
106
        );
107
        compare(
107
        compare(
108
            {
108
            {
109
                got      => $order_0_0->{gstvalue},
109
                got      => $order_0_0->{tax_value},
110
                expected => 7.38,
110
                expected => 7.38,
111
                conf     => '0 0',
111
                conf     => '0 0',
112
                field    => 'gstvalue'
112
                field    => 'tax_value'
113
            }
113
            }
114
        );
114
        );
115
        compare(
115
        compare(
116
            {
116
            {
117
                got      => $order_0_0->{totalgsti},
117
                got      => $order_0_0->{total_tax_included},
118
                expected => 154.98,
118
                expected => 154.98,
119
                conf     => '0 0',
119
                conf     => '0 0',
120
                field    => 'totalgsti'
120
                field    => 'total_tax_included'
121
            }
121
            }
122
        );
122
        );
123
        compare(
123
        compare(
124
            {
124
            {
125
                got      => $order_0_0->{totalgste},
125
                got      => $order_0_0->{total_tax_excluded},
126
                expected => 147.60,
126
                expected => 147.60,
127
                conf     => '0 0',
127
                conf     => '0 0',
128
                field    => 'totalgste'
128
                field    => 'total_tax_excluded'
129
            }
129
            }
130
        );
130
        );
131
131
Lines 140-181 for my $currency_format ( qw( US FR ) ) { Link Here
140
        # Note that this configuration is correct \o/
140
        # Note that this configuration is correct \o/
141
        compare(
141
        compare(
142
            {
142
            {
143
                got      => $order_0_0->{unitpricegsti},
143
                got      => $order_0_0->{unitprice_tax_included},
144
                expected => 77.49,
144
                expected => 77.49,
145
                conf     => '0 0',
145
                conf     => '0 0',
146
                field    => 'unitpricegsti'
146
                field    => 'unitprice_tax_included'
147
            }
147
            }
148
        );
148
        );
149
        compare(
149
        compare(
150
            {
150
            {
151
                got      => $order_0_0->{unitpricegste},
151
                got      => $order_0_0->{unitprice_tax_excluded},
152
                expected => 73.80,
152
                expected => 73.80,
153
                conf     => '0 0',
153
                conf     => '0 0',
154
                field    => 'unitpricegste'
154
                field    => 'unitprice_tax_excluded'
155
            }
155
            }
156
        );
156
        );
157
        compare(
157
        compare(
158
            {
158
            {
159
                got      => $order_0_0->{gstvalue},
159
                got      => $order_0_0->{tax_value},
160
                expected => 7.38,
160
                expected => 7.38,
161
                conf     => '0 0',
161
                conf     => '0 0',
162
                field    => 'gstvalue'
162
                field    => 'tax_value'
163
            }
163
            }
164
        );
164
        );
165
        compare(
165
        compare(
166
            {
166
            {
167
                got      => $order_0_0->{totalgsti},
167
                got      => $order_0_0->{total_tax_included},
168
                expected => 154.98,
168
                expected => 154.98,
169
                conf     => '0 0',
169
                conf     => '0 0',
170
                field    => 'totalgsti'
170
                field    => 'total_tax_included'
171
            }
171
            }
172
        );
172
        );
173
        compare(
173
        compare(
174
            {
174
            {
175
                got      => $order_0_0->{totalgste},
175
                got      => $order_0_0->{total_tax_excluded},
176
                expected => 147.60,
176
                expected => 147.60,
177
                conf     => '0 0',
177
                conf     => '0 0',
178
                field    => 'totalgste'
178
                field    => 'total_tax_excluded'
179
            }
179
            }
180
        );
180
        );
181
    };
181
    };
Lines 200-206 for my $currency_format ( qw( US FR ) ) { Link Here
200
            invoiceid        => $invoiceid_1_1,
200
            invoiceid        => $invoiceid_1_1,
201
            rrp              => 82.00,
201
            rrp              => 82.00,
202
            ecost            => 73.80,
202
            ecost            => 73.80,
203
            gstrate          => 0.0500,
203
            tax_rate         => 0.0500,
204
            discount         => 10.0000,
204
            discount         => 10.0000,
205
            datereceived     => $today
205
            datereceived     => $today
206
        };
206
        };
Lines 214-274 for my $currency_format ( qw( US FR ) ) { Link Here
214
        );
214
        );
215
215
216
        # Note that this configuration is *not* correct
216
        # Note that this configuration is *not* correct
217
        # gstvalue should be 7.03 instead of 7.02
217
        # tax_value should be 7.03 instead of 7.02
218
        compare(
218
        compare(
219
            {
219
            {
220
                got      => $order_1_1->{rrpgsti},
220
                got      => $order_1_1->{rrp_tax_included},
221
                expected => 82.00,
221
                expected => 82.00,
222
                conf     => '1 1',
222
                conf     => '1 1',
223
                field    => 'rrpgsti'
223
                field    => 'rrp_tax_included'
224
            }
224
            }
225
        );
225
        );
226
        compare(
226
        compare(
227
            {
227
            {
228
                got      => $order_1_1->{rrpgste},
228
                got      => $order_1_1->{rrp_tax_excluded},
229
                expected => 78.10,
229
                expected => 78.10,
230
                conf     => '1 1',
230
                conf     => '1 1',
231
                field    => 'rrpgste'
231
                field    => 'rrp_tax_excluded'
232
            }
232
            }
233
        );
233
        );
234
        compare(
234
        compare(
235
            {
235
            {
236
                got      => $order_1_1->{ecostgsti},
236
                got      => $order_1_1->{ecost_tax_included},
237
                expected => 73.80,
237
                expected => 73.80,
238
                conf     => '1 1',
238
                conf     => '1 1',
239
                field    => 'ecostgsti'
239
                field    => 'ecost_tax_included'
240
            }
240
            }
241
        );
241
        );
242
        compare(
242
        compare(
243
            {
243
            {
244
                got      => $order_1_1->{ecostgste},
244
                got      => $order_1_1->{ecost_tax_excluded},
245
                expected => 70.29,
245
                expected => 70.29,
246
                conf     => '1 1',
246
                conf     => '1 1',
247
                field    => 'ecostgste'
247
                field    => 'ecost_tax_excluded'
248
            }
248
            }
249
        );
249
        );
250
        compare(
250
        compare(
251
            {
251
            {
252
                got      => $order_1_1->{gstvalue},
252
                got      => $order_1_1->{tax_value},
253
                expected => 7.02,
253
                expected => 7.02,
254
                conf     => '1 1',
254
                conf     => '1 1',
255
                field    => 'gstvalue'
255
                field    => 'tax_value'
256
            }
256
            }
257
        );
257
        );
258
        compare(
258
        compare(
259
            {
259
            {
260
                got      => $order_1_1->{totalgsti},
260
                got      => $order_1_1->{total_tax_included},
261
                expected => 147.60,
261
                expected => 147.60,
262
                conf     => '1 1',
262
                conf     => '1 1',
263
                field    => 'totalgsti'
263
                field    => 'total_tax_included'
264
            }
264
            }
265
        );
265
        );
266
        compare(
266
        compare(
267
            {
267
            {
268
                got      => $order_1_1->{totalgste},
268
                got      => $order_1_1->{total_tax_excluded},
269
                expected => 140.58,
269
                expected => 140.58,
270
                conf     => '1 1',
270
                conf     => '1 1',
271
                field    => 'totalgste'
271
                field    => 'total_tax_excluded'
272
            }
272
            }
273
        );
273
        );
274
274
Lines 280-324 for my $currency_format ( qw( US FR ) ) { Link Here
280
            }
280
            }
281
        );
281
        );
282
        # Note that this configuration is *not* correct!
282
        # Note that this configuration is *not* correct!
283
        # gstvalue should be 7.03
283
        # tax_value should be 7.03
284
        compare(
284
        compare(
285
            {
285
            {
286
                got      => $order_1_1->{unitpricegsti},
286
                got      => $order_1_1->{unitprice_tax_included},
287
                expected => 73.80,
287
                expected => 73.80,
288
                conf     => '1 1',
288
                conf     => '1 1',
289
                field    => 'unitpricegsti'
289
                field    => 'unitprice_tax_included'
290
            }
290
            }
291
        );
291
        );
292
        compare(
292
        compare(
293
            {
293
            {
294
                got      => $order_1_1->{unitpricegste},
294
                got      => $order_1_1->{unitprice_tax_excluded},
295
                expected => 70.29,
295
                expected => 70.29,
296
                conf     => '1 1',
296
                conf     => '1 1',
297
                field    => 'unitpricegste'
297
                field    => 'unitprice_tax_excluded'
298
            }
298
            }
299
        );
299
        );
300
        compare(
300
        compare(
301
            {
301
            {
302
                got      => $order_1_1->{gstvalue},
302
                got      => $order_1_1->{tax_value},
303
                expected => 7.02,
303
                expected => 7.02,
304
                conf     => '1 1',
304
                conf     => '1 1',
305
                field    => 'gstvalue'
305
                field    => 'tax_value'
306
            }
306
            }
307
        );
307
        );
308
        compare(
308
        compare(
309
            {
309
            {
310
                got      => $order_1_1->{totalgsti},
310
                got      => $order_1_1->{total_tax_included},
311
                expected => 147.60,
311
                expected => 147.60,
312
                conf     => '1 1',
312
                conf     => '1 1',
313
                field    => 'totalgsti'
313
                field    => 'total_tax_included'
314
            }
314
            }
315
        );
315
        );
316
        compare(
316
        compare(
317
            {
317
            {
318
                got      => $order_1_1->{totalgste},
318
                got      => $order_1_1->{total_tax_excluded},
319
                expected => 140.58,
319
                expected => 140.58,
320
                conf     => '1 1',
320
                conf     => '1 1',
321
                field    => 'totalgste'
321
                field    => 'total_tax_excluded'
322
            }
322
            }
323
        );
323
        );
324
    };
324
    };
Lines 343-349 for my $currency_format ( qw( US FR ) ) { Link Here
343
            invoiceid        => $invoiceid_1_1,
343
            invoiceid        => $invoiceid_1_1,
344
            rrp              => 82.01,
344
            rrp              => 82.01,
345
            ecost            => 73.80,
345
            ecost            => 73.80,
346
            gstrate          => 0.0500,
346
            tax_rate         => 0.0500,
347
            discount         => 10.0000,
347
            discount         => 10.0000,
348
            datereceived     => $today
348
            datereceived     => $today
349
        };
349
        };
Lines 357-420 for my $currency_format ( qw( US FR ) ) { Link Here
357
        );
357
        );
358
358
359
        # Note that this configuration is *not* correct!
359
        # Note that this configuration is *not* correct!
360
        # rrp gsti should be 82 (what we inserted!)
360
        # rrp_tax_included should be 82 (what we inserted!)
361
        # => Actually we need to fix the inserted value (here we have 82.01 in DB)
361
        # tax_value should be 7.03 instead of 7.02
362
        # gstvalue should be 7.03 instead of 7.02
363
362
364
        compare(
363
        compare(
365
            {
364
            {
366
                got      => $order_1_0->{rrpgsti},
365
                got      => $order_1_0->{rrp_tax_included},
367
                expected => 82.01,
366
                expected => 82.01,
368
                conf     => '1 0',
367
                conf     => '1 0',
369
                field    => 'rrpgsti'
368
                field    => 'rrp_tax_included'
370
            }
369
            }
371
        );
370
        );
372
        compare(
371
        compare(
373
            {
372
            {
374
                got      => $order_1_0->{rrpgste},
373
                got      => $order_1_0->{rrp_tax_excluded},
375
                expected => 78.10,
374
                expected => 78.10,
376
                conf     => '1 0',
375
                conf     => '1 0',
377
                field    => 'rrpgste'
376
                field    => 'rrp_tax_excluded'
378
            }
377
            }
379
        );
378
        );
380
        compare(
379
        compare(
381
            {
380
            {
382
                got      => $order_1_0->{ecostgsti},
381
                got      => $order_1_0->{ecost_tax_included},
383
                expected => 73.80,
382
                expected => 73.80,
384
                conf     => '1 0',
383
                conf     => '1 0',
385
                field    => 'ecostgsti'
384
                field    => 'ecost_tax_included'
386
            }
385
            }
387
        );
386
        );
388
        compare(
387
        compare(
389
            {
388
            {
390
                got      => $order_1_0->{ecostgste},
389
                got      => $order_1_0->{ecost_tax_excluded},
391
                expected => 70.29,
390
                expected => 70.29,
392
                conf     => '1 0',
391
                conf     => '1 0',
393
                field    => 'ecostgste'
392
                field    => 'ecost_tax_excluded'
394
            }
393
            }
395
        );
394
        );
396
        compare(
395
        compare(
397
            {
396
            {
398
                got      => $order_1_0->{gstvalue},
397
                got      => $order_1_0->{tax_value},
399
                expected => 7.02,
398
                expected => 7.02,
400
                conf     => '1 0',
399
                conf     => '1 0',
401
                field    => 'gstvalue'
400
                field    => 'tax_value'
402
            }
401
            }
403
        );
402
        );
404
        compare(
403
        compare(
405
            {
404
            {
406
                got      => $order_1_0->{totalgsti},
405
                got      => $order_1_0->{total_tax_included},
407
                expected => 147.60,
406
                expected => 147.60,
408
                conf     => '1 0',
407
                conf     => '1 0',
409
                field    => 'totalgsti'
408
                field    => 'total_tax_included'
410
            }
409
            }
411
        );
410
        );
412
        compare(
411
        compare(
413
            {
412
            {
414
                got      => $order_1_0->{totalgste},
413
                got      => $order_1_0->{total_tax_excluded},
415
                expected => 140.58,
414
                expected => 140.58,
416
                conf     => '1 0',
415
                conf     => '1 0',
417
                field    => 'totalgste'
416
                field    => 'total_tax_excluded'
418
            }
417
            }
419
        );
418
        );
420
419
Lines 429-470 for my $currency_format ( qw( US FR ) ) { Link Here
429
        # gstvalue should be 7.03
428
        # gstvalue should be 7.03
430
        compare(
429
        compare(
431
            {
430
            {
432
                got      => $order_1_0->{unitpricegsti},
431
                got      => $order_1_0->{unitprice_tax_included},
433
                expected => 73.80,
432
                expected => 73.80,
434
                conf     => '1 0',
433
                conf     => '1 0',
435
                field    => 'unitpricegsti'
434
                field    => 'unitprice_tax_included'
436
            }
435
            }
437
        );
436
        );
438
        compare(
437
        compare(
439
            {
438
            {
440
                got      => $order_1_0->{unitpricegste},
439
                got      => $order_1_0->{unitprice_tax_excluded},
441
                expected => 70.29,
440
                expected => 70.29,
442
                conf     => '1 0',
441
                conf     => '1 0',
443
                field    => 'unitpricegste'
442
                field    => 'unitprice_tax_excluded'
444
            }
443
            }
445
        );
444
        );
446
        compare(
445
        compare(
447
            {
446
            {
448
                got      => $order_1_0->{gstvalue},
447
                got      => $order_1_0->{tax_value},
449
                expected => 7.02,
448
                expected => 7.02,
450
                conf     => '1 0',
449
                conf     => '1 0',
451
                field    => 'gstvalue'
450
                field    => 'tax_value'
452
            }
451
            }
453
        );
452
        );
454
        compare(
453
        compare(
455
            {
454
            {
456
                got      => $order_1_0->{totalgsti},
455
                got      => $order_1_0->{total_tax_included},
457
                expected => 147.60,
456
                expected => 147.60,
458
                conf     => '1 0',
457
                conf     => '1 0',
459
                field    => 'totalgsti'
458
                field    => 'total_tax_included'
460
            }
459
            }
461
        );
460
        );
462
        compare(
461
        compare(
463
            {
462
            {
464
                got      => $order_1_0->{totalgste},
463
                got      => $order_1_0->{total_tax_excluded},
465
                expected => 140.58,
464
                expected => 140.58,
466
                conf     => '1 0',
465
                conf     => '1 0',
467
                field    => 'totalgste'
466
                field    => 'total_tax_excluded'
468
            }
467
            }
469
        );
468
        );
470
    };
469
    };
Lines 489-495 for my $currency_format ( qw( US FR ) ) { Link Here
489
            invoiceid        => $invoiceid_1_1,
488
            invoiceid        => $invoiceid_1_1,
490
            rrp              => 82.00,
489
            rrp              => 82.00,
491
            ecost            => 73.80,
490
            ecost            => 73.80,
492
            gstrate          => 0.0500,
491
            tax_rate         => 0.0500,
493
            discount         => 10.0000,
492
            discount         => 10.0000,
494
            datereceived     => $today
493
            datereceived     => $today
495
        };
494
        };
Lines 505-562 for my $currency_format ( qw( US FR ) ) { Link Here
505
        # Note that this configuration is correct \o/
504
        # Note that this configuration is correct \o/
506
        compare(
505
        compare(
507
            {
506
            {
508
                got      => $order_0_1->{rrpgsti},
507
                got      => $order_0_1->{rrp_tax_included},
509
                expected => 86.10,
508
                expected => 86.10,
510
                conf     => '1 0',
509
                conf     => '1 0',
511
                field    => 'rrpgsti'
510
                field    => 'rrp_tax_included'
512
            }
511
            }
513
        );
512
        );
514
        compare(
513
        compare(
515
            {
514
            {
516
                got      => $order_0_1->{rrpgste},
515
                got      => $order_0_1->{rrp_tax_excluded},
517
                expected => 82.00,
516
                expected => 82.00,
518
                conf     => '1 0',
517
                conf     => '1 0',
519
                field    => 'rrpgste'
518
                field    => 'rrp_tax_excluded'
520
            }
519
            }
521
        );
520
        );
522
        compare(
521
        compare(
523
            {
522
            {
524
                got      => $order_0_1->{ecostgsti},
523
                got      => $order_0_1->{ecost_tax_included},
525
                expected => 77.49,
524
                expected => 77.49,
526
                conf     => '1 0',
525
                conf     => '1 0',
527
                field    => 'ecostgsti'
526
                field    => 'ecost_tax_included'
528
            }
527
            }
529
        );
528
        );
530
        compare(
529
        compare(
531
            {
530
            {
532
                got      => $order_0_1->{ecostgste},
531
                got      => $order_0_1->{ecost_tax_excluded},
533
                expected => 73.80,
532
                expected => 73.80,
534
                conf     => '1 0',
533
                conf     => '1 0',
535
                field    => 'ecostgste'
534
                field    => 'ecost_tax_excluded'
536
            }
535
            }
537
        );
536
        );
538
        compare(
537
        compare(
539
            {
538
            {
540
                got      => $order_0_1->{gstvalue},
539
                got      => $order_0_1->{tax_value},
541
                expected => 7.38,
540
                expected => 7.38,
542
                conf     => '1 0',
541
                conf     => '1 0',
543
                field    => 'gstvalue'
542
                field    => 'tax_value'
544
            }
543
            }
545
        );
544
        );
546
        compare(
545
        compare(
547
            {
546
            {
548
                got      => $order_0_1->{totalgsti},
547
                got      => $order_0_1->{total_tax_included},
549
                expected => 154.98,
548
                expected => 154.98,
550
                conf     => '1 0',
549
                conf     => '1 0',
551
                field    => 'totalgsti'
550
                field    => 'total_tax_included'
552
            }
551
            }
553
        );
552
        );
554
        compare(
553
        compare(
555
            {
554
            {
556
                got      => $order_0_1->{totalgste},
555
                got      => $order_0_1->{total_tax_excluded},
557
                expected => 147.60,
556
                expected => 147.60,
558
                conf     => '1 0',
557
                conf     => '1 0',
559
                field    => 'totalgste'
558
                field    => 'total_tax_excluded'
560
            }
559
            }
561
        );
560
        );
562
561
Lines 570-611 for my $currency_format ( qw( US FR ) ) { Link Here
570
        # Note that this configuration is correct
569
        # Note that this configuration is correct
571
        compare(
570
        compare(
572
            {
571
            {
573
                got      => $order_0_1->{unitpricegsti},
572
                got      => $order_0_1->{unitprice_tax_included},
574
                expected => 77.49,
573
                expected => 77.49,
575
                conf     => '0 1',
574
                conf     => '0 1',
576
                field    => 'unitpricegsti'
575
                field    => 'unitprice_tax_included'
577
            }
576
            }
578
        );
577
        );
579
        compare(
578
        compare(
580
            {
579
            {
581
                got      => $order_0_1->{unitpricegste},
580
                got      => $order_0_1->{unitprice_tax_excluded},
582
                expected => 73.80,
581
                expected => 73.80,
583
                conf     => '0 1',
582
                conf     => '0 1',
584
                field    => 'unitpricegste'
583
                field    => 'unitprice_tax_excluded'
585
            }
584
            }
586
        );
585
        );
587
        compare(
586
        compare(
588
            {
587
            {
589
                got      => $order_0_1->{gstvalue},
588
                got      => $order_0_1->{tax_value},
590
                expected => 7.38,
589
                expected => 7.38,
591
                conf     => '0 1',
590
                conf     => '0 1',
592
                field    => 'gstvalue'
591
                field    => 'tax_value'
593
            }
592
            }
594
        );
593
        );
595
        compare(
594
        compare(
596
            {
595
            {
597
                got      => $order_0_1->{totalgsti},
596
                got      => $order_0_1->{total_tax_included},
598
                expected => 154.98,
597
                expected => 154.98,
599
                conf     => '0 1',
598
                conf     => '0 1',
600
                field    => 'totalgsti'
599
                field    => 'total_tax_included'
601
            }
600
            }
602
        );
601
        );
603
        compare(
602
        compare(
604
            {
603
            {
605
                got      => $order_0_1->{totalgste},
604
                got      => $order_0_1->{total_tax_excluded},
606
                expected => 147.60,
605
                expected => 147.60,
607
                conf     => '0 1',
606
                conf     => '0 1',
608
                field    => 'totalgste'
607
                field    => 'total_tax_excluded'
609
            }
608
            }
610
        );
609
        );
611
    };
610
    };
(-)a/t/db_dependent/Acquisition.t (-36 / +48 lines)
Lines 181-187 my @order_content = ( Link Here
181
            ecost     => 38.15,
181
            ecost     => 38.15,
182
            rrp       => 40.15,
182
            rrp       => 40.15,
183
            discount  => 5.1111,
183
            discount  => 5.1111,
184
            gstrate   => 0.0515
184
            tax_rate   => 0.0515
185
        }
185
        }
186
    },
186
    },
187
    {
187
    {
Lines 209-215 my @order_content = ( Link Here
209
            ecost     => 38.1,
209
            ecost     => 38.1,
210
            rrp       => 11.0,
210
            rrp       => 11.0,
211
            discount  => 5.1,
211
            discount  => 5.1,
212
            gstrate   => 0.1
212
            tax_rate   => 0.1
213
        }
213
        }
214
    },
214
    },
215
    {
215
    {
Lines 229-235 my @order_content = ( Link Here
229
            rrp            => 11.00,
229
            rrp            => 11.00,
230
            discount       => 0,
230
            discount       => 0,
231
            uncertainprice => 0,
231
            uncertainprice => 0,
232
            gstrate        => 0
232
            tax_rate        => 0
233
        }
233
        }
234
    },
234
    },
235
    {
235
    {
Lines 249-255 my @order_content = ( Link Here
249
            rrp            => 10,
249
            rrp            => 10,
250
            discount       => 0,
250
            discount       => 0,
251
            uncertainprice => 0,
251
            uncertainprice => 0,
252
            gstrate        => 0
252
            tax_rate        => 0
253
        }
253
        }
254
    }
254
    }
255
);
255
);
Lines 339-354 my @expectedfields = qw( Link Here
339
  invoiceid
339
  invoiceid
340
  freight
340
  freight
341
  unitprice
341
  unitprice
342
  unitprice_tax_included
343
  unitprice_tax_excluded
342
  quantityreceived
344
  quantityreceived
343
  datecancellationprinted
345
  datecancellationprinted
344
  purchaseordernumber
346
  purchaseordernumber
345
  basketno
347
  basketno
346
  timestamp
348
  timestamp
347
  rrp
349
  rrp
350
  rrp_tax_included
351
  rrp_tax_excluded
348
  ecost
352
  ecost
353
  ecost_tax_included
354
  ecost_tax_excluded
349
  unitpricesupplier
355
  unitpricesupplier
350
  unitpricelib
356
  unitpricelib
351
  gstrate
357
  tax_rate
358
  tax_value
352
  discount
359
  discount
353
  budget_id
360
  budget_id
354
  budgetgroup_id
361
  budgetgroup_id
Lines 417-422 my @base_expectedfields = qw( Link Here
417
  notes
424
  notes
418
  ordernumber
425
  ordernumber
419
  ecost
426
  ecost
427
  ecost_tax_included
428
  ecost_tax_excluded
420
  uncertainprice
429
  uncertainprice
421
  marc
430
  marc
422
  url
431
  url
Lines 447-452 my @base_expectedfields = qw( Link Here
447
  budget_parent_id
456
  budget_parent_id
448
  publishercode
457
  publishercode
449
  unitprice
458
  unitprice
459
  unitprice_tax_included
460
  unitprice_tax_excluded
450
  collectionvolume
461
  collectionvolume
451
  budget_amount
462
  budget_amount
452
  budget_owner_id
463
  budget_owner_id
Lines 468-474 my @base_expectedfields = qw( Link Here
468
  suppliers_report
479
  suppliers_report
469
  agerestriction
480
  agerestriction
470
  budget_branchcode
481
  budget_branchcode
471
  gstrate
482
  tax_rate
483
  tax_value
472
  listprice
484
  listprice
473
  budget_code
485
  budget_code
474
  budgetdate
486
  budgetdate
Lines 492-497 my @base_expectedfields = qw( Link Here
492
  sort2_authcat
504
  sort2_authcat
493
  budget_expend
505
  budget_expend
494
  rrp
506
  rrp
507
  rrp_tax_included
508
  rrp_tax_excluded
495
  cn_sort
509
  cn_sort
496
  lccn
510
  lccn
497
  sort1
511
  sort1
Lines 579-584 ok( Link Here
579
  firstname
593
  firstname
580
  biblioitemnumber
594
  biblioitemnumber
581
  ecost
595
  ecost
596
  ecost_tax_included
597
  ecost_tax_excluded
582
  uncertainprice
598
  uncertainprice
583
  creationdate
599
  creationdate
584
  datereceived
600
  datereceived
Lines 589-595 ok( Link Here
589
  suppliers_report
605
  suppliers_report
590
  isbn
606
  isbn
591
  copyrightdate
607
  copyrightdate
592
  gstrate
608
  tax_rate
609
  tax_value
593
  serial
610
  serial
594
  listprice
611
  listprice
595
  budgetdate
612
  budgetdate
Lines 616-622 ok( Link Here
616
  unititle
633
  unititle
617
  sort2_authcat
634
  sort2_authcat
618
  rrp
635
  rrp
636
  rrp_tax_included
637
  rrp_tax_excluded
619
  unitprice
638
  unitprice
639
  unitprice_tax_included
640
  unitprice_tax_excluded
620
  sort1
641
  sort1
621
  ordernumber
642
  ordernumber
622
  datecreated
643
  datecreated
Lines 642-656 my $invoiceid = AddInvoice( Link Here
642
    unknown       => "unknown"
663
    unknown       => "unknown"
643
);
664
);
644
665
666
my $invoice = GetInvoice( $invoiceid );
667
645
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
668
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
646
    {
669
    {
647
        biblionumber      => $biblionumber4,
670
        biblionumber      => $biblionumber4,
648
        ordernumber       => $ordernumbers[4],
671
        order             => GetOrder( $ordernumbers[4] ),
649
        quantityreceived  => 1,
672
        quantityreceived  => 1,
650
        cost              => 10,
673
        invoice           => $invoice,
651
        ecost             => 10,
652
        invoiceid         => $invoiceid,
653
        rrp               => 10,
654
        budget_id          => $order_content[4]->{str}->{budget_id},
674
        budget_id          => $order_content[4]->{str}->{budget_id},
655
    }
675
    }
656
);
676
);
Lines 808-827 is( Link Here
808
    "AddClaim : Check claimed_date"
828
    "AddClaim : Check claimed_date"
809
);
829
);
810
830
831
my $order2 = GetOrder( $ordernumbers[1] );
832
$order2->{order_internalnote} = "my notes";
811
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
833
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
812
    {
834
    {
813
        biblionumber     => $biblionumber2,
835
        biblionumber     => $biblionumber2,
814
        ordernumber      => $ordernumbers[1],
836
        order            => $order2,
815
        quantityreceived => 2,
837
        quantityreceived => 2,
816
        cost             => 12,
838
        invoice          => $invoice,
817
        ecost            => 12,
818
        invoiceid        => $invoiceid,
819
        rrp              => 42,
820
        order_internalnote => "my notes",
821
        order_vendornote   => "my vendor notes",
822
    }
839
    }
823
);
840
)
824
my $order2 = GetOrder( $ordernumbers[1] );
841
;
842
$order2 = GetOrder( $ordernumbers[1] );
825
is( $order2->{'quantityreceived'},
843
is( $order2->{'quantityreceived'},
826
    0, 'Splitting up order did not receive any on original order' );
844
    0, 'Splitting up order did not receive any on original order' );
827
is( $order2->{'quantity'}, 40, '40 items on original order' );
845
is( $order2->{'quantity'}, 40, '40 items on original order' );
Lines 829-836 is( $order2->{'budget_id'}, $budgetid, Link Here
829
    'Budget on original order is unchanged' );
847
    'Budget on original order is unchanged' );
830
is( $order2->{order_internalnote}, "my notes",
848
is( $order2->{order_internalnote}, "my notes",
831
    'ModReceiveOrder and GetOrder deal with internal notes' );
849
    'ModReceiveOrder and GetOrder deal with internal notes' );
832
is( $order2->{order_vendornote}, "my vendor notes",
833
    'ModReceiveOrder and GetOrder deal with vendor notes' );
834
850
835
$neworder = GetOrder($new_ordernumber);
851
$neworder = GetOrder($new_ordernumber);
836
is( $neworder->{'quantity'}, 2, '2 items on new order' );
852
is( $neworder->{'quantity'}, 2, '2 items on new order' );
Lines 853-873 my $budgetid2 = C4::Budgets::AddBudget( Link Here
853
    }
869
    }
854
);
870
);
855
871
872
my $order3 = GetOrder( $ordernumbers[2] );
873
$order3->{order_internalnote} = "my other notes";
856
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
874
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
857
    {
875
    {
858
        biblionumber     => $biblionumber2,
876
        biblionumber     => $biblionumber2,
859
        ordernumber      => $ordernumbers[2],
877
        order            => $order3,
860
        quantityreceived => 2,
878
        quantityreceived => 2,
861
        cost             => 12,
879
        invoice          => $invoice,
862
        ecost            => 12,
863
        invoiceid        => $invoiceid,
864
        rrp              => 42,
865
        budget_id        => $budgetid2,
880
        budget_id        => $budgetid2,
866
        order_internalnote => "my other notes",
867
    }
881
    }
868
);
882
);
869
883
870
my $order3 = GetOrder( $ordernumbers[2] );
884
$order3 = GetOrder( $ordernumbers[2] );
871
is( $order3->{'quantityreceived'},
885
is( $order3->{'quantityreceived'},
872
    0, 'Splitting up order did not receive any on original order' );
886
    0, 'Splitting up order did not receive any on original order' );
873
is( $order3->{'quantity'}, 2, '2 items on original order' );
887
is( $order3->{'quantity'}, 2, '2 items on original order' );
Lines 882-898 is( $neworder->{'quantityreceived'}, Link Here
882
    2, 'Splitting up order received items on new order' );
896
    2, 'Splitting up order received items on new order' );
883
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
897
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
884
898
899
$order3 = GetOrder( $ordernumbers[2] );
900
$order3->{order_internalnote} = "my third notes";
885
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
901
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
886
    {
902
    {
887
        biblionumber     => $biblionumber2,
903
        biblionumber     => $biblionumber2,
888
        ordernumber      => $ordernumbers[2],
904
        order            => $order3,
889
        quantityreceived => 2,
905
        quantityreceived => 2,
890
        cost             => 12,
906
        invoice          => $invoice,
891
        ecost            => 12,
892
        invoiceid        => $invoiceid,
893
        rrp              => 42,
894
        budget_id        => $budgetid2,
907
        budget_id        => $budgetid2,
895
        order_internalnote => "my third notes",
896
    }
908
    }
897
);
909
);
898
910
(-)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 316-321 my @order_infos = ( Link Here
316
316
317
my %budgets;
317
my %budgets;
318
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
318
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
319
my $invoice = GetInvoice( $invoiceid );
319
my $item_price = 10;
320
my $item_price = 10;
320
my $item_quantity = 2;
321
my $item_quantity = 2;
321
my $number_of_orders_to_move = 0;
322
my $number_of_orders_to_move = 0;
Lines 336-342 for my $infos (@order_infos) { Link Here
336
                rrp                => $item_price,
337
                rrp                => $item_price,
337
                discount           => 0,
338
                discount           => 0,
338
                uncertainprice     => 0,
339
                uncertainprice     => 0,
339
                gstrate            => 0,
340
                tax_rate            => 0,
340
            }
341
            }
341
        )->insert;
342
        )->insert;
342
        my $ordernumber = $order->{ordernumber};
343
        my $ordernumber = $order->{ordernumber};
Lines 359-377 for my $infos (@order_infos) { Link Here
359
                rrp                => $item_price,
360
                rrp                => $item_price,
360
                discount           => 0,
361
                discount           => 0,
361
                uncertainprice     => 0,
362
                uncertainprice     => 0,
362
                gstrate            => 0,
363
                tax_rate            => 0,
363
            }
364
            }
364
        )->insert;
365
        )->insert;
365
        my $ordernumber = $order->{ordernumber};
366
        my $ordernumber = $order->{ordernumber};
366
        ModReceiveOrder({
367
        ModReceiveOrder({
367
              biblionumber     => $biblionumber,
368
              biblionumber     => $biblionumber,
368
              ordernumber      => $ordernumber,
369
              order            => $order,
369
              budget_id        => $infos->{budget_id},
370
              budget_id        => $infos->{budget_id},
370
              quantityreceived => $item_quantity,
371
              quantityreceived => $item_quantity,
371
              cost             => $item_price,
372
              invoice          => $invoice,
372
              ecost            => $item_price,
373
              invoiceid        => $invoiceid,
374
              rrp              => $item_price,
375
              received_items   => [],
373
              received_items   => [],
376
        } );
374
        } );
377
    }
375
    }
(-)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