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

(-)a/C4/Acquisition.pm (-111 / +101 lines)
Lines 1325-1382 sub ModItemOrder { Link Here
1325
1325
1326
=head3 ModReceiveOrder
1326
=head3 ModReceiveOrder
1327
1327
1328
  &ModReceiveOrder({
1328
    my ( $date_received, $new_ordernumber ) = ModReceiveOrder(
1329
    biblionumber => $biblionumber,
1329
        {
1330
    ordernumber => $ordernumber,
1330
            biblionumber         => $biblionumber,
1331
    quantityreceived => $quantityreceived,
1331
            order                => $order,
1332
    user => $user,
1332
            quantityreceived     => $quantityreceived,
1333
    cost => $cost,
1333
            user                 => $user,
1334
    ecost => $ecost,
1334
            invoice              => $invoice,
1335
    invoiceid => $invoiceid,
1335
            budget_id            => $budget_id,
1336
    rrp => $rrp,
1336
            received_itemnumbers => \@received_itemnumbers,
1337
    budget_id => $budget_id,
1337
            order_internalnote   => $order_internalnote,
1338
    datereceived => $datereceived,
1338
        }
1339
    received_itemnumbers => \@received_itemnumbers,
1339
    );
1340
    order_internalnote => $order_internalnote,
1341
    order_vendornote => $order_vendornote,
1342
   });
1343
1340
1344
Updates an order, to reflect the fact that it was received, at least
1341
Updates an order, to reflect the fact that it was received, at least
1345
in part. All arguments not mentioned below update the fields with the
1342
in part.
1346
same name in the aqorders table of the Koha database.
1347
1343
1348
If a partial order is received, splits the order into two.
1344
If a partial order is received, splits the order into two.
1349
1345
1350
Updates the order with bibilionumber C<$biblionumber> and ordernumber
1346
Updates the order with biblionumber C<$biblionumber> and ordernumber
1351
C<$ordernumber>.
1347
C<$order->{ordernumber}>.
1352
1348
1353
=cut
1349
=cut
1354
1350
1355
1351
1356
sub ModReceiveOrder {
1352
sub ModReceiveOrder {
1357
    my ( $params ) = @_;
1353
    my ($params)       = @_;
1358
    my $biblionumber = $params->{biblionumber};
1354
    my $biblionumber   = $params->{biblionumber};
1359
    my $ordernumber = $params->{ordernumber};
1355
    my $order          = { %{ $params->{order} } }; # Copy the order, we don't want to modify it
1360
    my $quantrec = $params->{quantityreceived};
1356
    my $invoice        = $params->{invoice};
1361
    my $user = $params->{user};
1357
    my $quantrec       = $params->{quantityreceived};
1362
    my $cost = $params->{cost};
1358
    my $user           = $params->{user};
1363
    my $ecost = $params->{ecost};
1359
    my $budget_id      = $params->{budget_id};
1364
    my $invoiceid = $params->{invoiceid};
1365
    my $rrp = $params->{rrp};
1366
    my $budget_id = $params->{budget_id};
1367
    my $datereceived = $params->{datereceived};
1368
    my $received_items = $params->{received_items};
1360
    my $received_items = $params->{received_items};
1369
    my $order_internalnote = $params->{order_internalnote};
1370
    my $order_vendornote = $params->{order_vendornote};
1371
1361
1372
    my $dbh = C4::Context->dbh;
1362
    my $dbh = C4::Context->dbh;
1373
    $datereceived = output_pref(
1363
    my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string;
1374
        {
1375
            dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ),
1376
            dateformat => 'iso',
1377
            dateonly => 1,
1378
        }
1379
    );
1380
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1364
    my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
1381
    if ($suggestionid) {
1365
    if ($suggestionid) {
1382
        ModSuggestion( {suggestionid=>$suggestionid,
1366
        ModSuggestion( {suggestionid=>$suggestionid,
Lines 1385-1399 sub ModReceiveOrder { Link Here
1385
                        );
1369
                        );
1386
    }
1370
    }
1387
1371
1388
    my $result_set = $dbh->selectall_arrayref(
1372
    my $new_ordernumber = $order->{ordernumber};
1389
q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?},
1390
        { Slice => {} }, $biblionumber, $ordernumber
1391
    );
1392
1393
    # we assume we have a unique order
1394
    my $order = $result_set->[0];
1395
1396
    my $new_ordernumber = $ordernumber;
1397
    if ( $order->{quantity} > $quantrec ) {
1373
    if ( $order->{quantity} > $quantrec ) {
1398
        # Split order line in two parts: the first is the original order line
1374
        # Split order line in two parts: the first is the original order line
1399
        # without received items (the quantity is decreased),
1375
        # without received items (the quantity is decreased),
Lines 1403-1430 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1403
            UPDATE aqorders
1379
            UPDATE aqorders
1404
            SET quantity = ?,
1380
            SET quantity = ?,
1405
                orderstatus = 'partial'|;
1381
                orderstatus = 'partial'|;
1406
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1382
        $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote};
1407
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1408
        $query .= q| WHERE ordernumber = ?|;
1383
        $query .= q| WHERE ordernumber = ?|;
1409
        my $sth = $dbh->prepare($query);
1384
        my $sth = $dbh->prepare($query);
1410
1385
1411
        $sth->execute(
1386
        $sth->execute(
1412
            $order->{quantity} - $quantrec,
1387
            $order->{quantity} - $quantrec,
1413
            ( defined $order_internalnote ? $order_internalnote : () ),
1388
            ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ),
1414
            ( defined $order_vendornote ? $order_vendornote : () ),
1389
            $order->{ordernumber}
1415
            $ordernumber
1416
        );
1390
        );
1417
1391
1418
        delete $order->{'ordernumber'};
1392
        delete $order->{ordernumber};
1419
        $order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} );
1393
        $order->{budget_id} = ( $budget_id || $order->{budget_id} );
1420
        $order->{'quantity'} = $quantrec;
1394
        $order->{quantity} = $quantrec;
1421
        $order->{'quantityreceived'} = $quantrec;
1395
        $order->{quantityreceived} = $quantrec;
1422
        $order->{'datereceived'} = $datereceived;
1396
        $order->{datereceived} = $datereceived;
1423
        $order->{'invoiceid'} = $invoiceid;
1397
        $order->{invoiceid} = $invoice->{invoiceid};
1424
        $order->{'unitprice'} = $cost;
1398
        $order->{orderstatus} = 'complete';
1425
        $order->{'rrp'} = $rrp;
1426
        $order->{ecost} = $ecost;
1427
        $order->{'orderstatus'} = 'complete';
1428
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1399
        $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
1429
1400
1430
        if ($received_items) {
1401
        if ($received_items) {
Lines 1434-1459 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, Link Here
1434
        }
1405
        }
1435
    } else {
1406
    } else {
1436
        my $query = q|
1407
        my $query = q|
1437
            update aqorders
1408
            UPDATE aqorders
1438
            set quantityreceived=?,datereceived=?,invoiceid=?,
1409
            SET quantityreceived = ?,
1439
                unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete'|;
1410
                datereceived = ?,
1440
        $query .= q|, order_internalnote = ?| if defined $order_internalnote;
1411
                invoiceid = ?,
1441
        $query .= q|, order_vendornote = ?| if defined $order_vendornote;
1412
                budget_id = ?,
1413
                orderstatus = 'complete'
1414
        |;
1415
1416
        $query .= q|
1417
            , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ?
1418
        | if defined $order->{unitprice};
1419
1420
        $query .= q|
1421
            , rrp = ?, rrp_tax_included = ?, rrp_tax_excluded = ?
1422
        | if defined $order->{rrp};
1423
1424
        $query .= q|
1425
            , ecost = ?, ecost_tax_included = ?, ecost_tax_excluded = ?
1426
        | if defined $order->{ecost};
1427
1428
        $query .= q|
1429
            , order_internalnote = ?
1430
        | if defined $order->{order_internalnote};
1431
1442
        $query .= q| where biblionumber=? and ordernumber=?|;
1432
        $query .= q| where biblionumber=? and ordernumber=?|;
1433
1443
        my $sth = $dbh->prepare( $query );
1434
        my $sth = $dbh->prepare( $query );
1444
        $sth->execute(
1435
        my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, $budget_id );
1445
            $quantrec,
1436
1446
            $datereceived,
1437
        if ( defined $order->{unitprice} ) {
1447
            $invoiceid,
1438
            push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded};
1448
            $cost,
1439
        }
1449
            $rrp,
1440
        if ( defined $order->{rrp} ) {
1450
            $ecost,
1441
            push @params, $order->{rrp}, $order->{rrp_tax_included}, $order->{rrp_tax_excluded};
1451
            ( $budget_id ? $budget_id : $order->{budget_id} ),
1442
        }
1452
            ( defined $order_internalnote ? $order_internalnote : () ),
1443
        if ( defined $order->{ecost} ) {
1453
            ( defined $order_vendornote ? $order_vendornote : () ),
1444
            push @params, $order->{ecost}, $order->{ecost_tax_included}, $order->{ecost_tax_excluded};
1454
            $biblionumber,
1445
        }
1455
            $ordernumber
1446
        if ( defined $order->{order_internalnote} ) {
1456
        );
1447
            push @params, $order->{order_internalnote};
1448
        }
1449
1450
        push @params, ( $biblionumber, $order->{ordernumber} );
1451
1452
        $sth->execute( @params );
1457
1453
1458
        # All items have been received, sent a notification to users
1454
        # All items have been received, sent a notification to users
1459
        NotifyOrderUsers( $ordernumber );
1455
        NotifyOrderUsers( $ordernumber );
Lines 2827-2876 sub populate_order_with_prices { Link Here
2827
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2823
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2828
    if ($ordering) {
2824
    if ($ordering) {
2829
        if ( $bookseller->{listincgst} ) {
2825
        if ( $bookseller->{listincgst} ) {
2830
            $order->{rrpgsti} = $order->{rrp};
2826
            $order->{rrp_tax_included} = $order->{rrp};
2831
            $order->{rrpgste} = Koha::Number::Price->new(
2827
            $order->{rrp_tax_excluded} = Koha::Number::Price->new(
2832
                $order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round;
2828
                $order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2833
            $order->{ecostgsti} = $order->{ecost};
2829
            $order->{ecost_tax_included} = $order->{ecost};
2834
            $order->{ecostgste} = Koha::Number::Price->new(
2830
            $order->{ecost_tax_excluded} = Koha::Number::Price->new(
2835
                $order->{ecost} / ( 1 + $order->{gstrate} ) )->round;
2831
                $order->{ecost} / ( 1 + $order->{tax_rate} ) )->round;
2836
            $order->{gstvalue} = Koha::Number::Price->new(
2832
            $order->{tax_value} = Koha::Number::Price->new(
2837
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2833
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2838
                  $order->{quantity} )->round;
2834
                  $order->{quantity} )->round;
2839
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2840
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2841
        }
2835
        }
2842
        else {
2836
        else {
2843
            $order->{rrpgste} = $order->{rrp};
2837
            $order->{rrp_tax_excluded} = $order->{rrp};
2844
            $order->{rrpgsti} = Koha::Number::Price->new(
2838
            $order->{rrp_tax_included} = Koha::Number::Price->new(
2845
                $order->{rrp} * ( 1 + $order->{gstrate} ) )->round;
2839
                $order->{rrp} * ( 1 + $order->{tax_rate} ) )->round;
2846
            $order->{ecostgste} = $order->{ecost};
2840
            $order->{ecost_tax_excluded} = $order->{ecost};
2847
            $order->{ecostgsti} = Koha::Number::Price->new(
2841
            $order->{ecost_tax_included} = Koha::Number::Price->new(
2848
                $order->{ecost} * ( 1 + $order->{gstrate} ) )->round;
2842
                $order->{ecost} * ( 1 + $order->{tax_rate} ) )->round;
2849
            $order->{gstvalue} = Koha::Number::Price->new(
2843
            $order->{tax_value} = Koha::Number::Price->new(
2850
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2844
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2851
                  $order->{quantity} )->round;
2845
                  $order->{quantity} )->round;
2852
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2853
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2854
        }
2846
        }
2855
    }
2847
    }
2856
2848
2857
    if ($receiving) {
2849
    if ($receiving) {
2858
        if ( $bookseller->{listincgst} ) {
2850
        if ( $bookseller->{listincgst} ) {
2859
            $order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round;
2851
            $order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round;
2860
            $order->{unitpricegste} = Koha::Number::Price->new(
2852
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new(
2861
              $order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round;
2853
              $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2862
        }
2854
        }
2863
        else {
2855
        else {
2864
            $order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round;
2856
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round;
2865
            $order->{unitpricegsti} = Koha::Number::Price->new(
2857
            $order->{unitprice_tax_included} = Koha::Number::Price->new(
2866
              $order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round;
2858
              $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round;
2867
        }
2859
        }
2868
        $order->{gstvalue} = Koha::Number::Price->new(
2860
        $order->{tax_value} = Koha::Number::Price->new(
2869
          ( $order->{unitpricegsti} - $order->{unitpricegste} )
2861
          ( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} )
2870
          * $order->{quantityreceived} )->round;
2862
          * $order->{quantityreceived} )->round;
2871
2863
2872
        $order->{totalgste} = $order->{unitpricegste} * $order->{quantity};
2873
        $order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity};
2874
    }
2864
    }
2875
2865
2876
    return $order;
2866
    return $order;
(-)a/C4/Bookseller.pm (-4 / +4 lines)
Lines 138-144 sub AddBookseller { Link Here
138
                name,      address1,      address2,     address3, address4,
138
                name,      address1,      address2,     address3, address4,
139
                postal,    phone,         accountnumber,fax,      url,
139
                postal,    phone,         accountnumber,fax,      url,
140
                active,    listprice,     invoiceprice, gstreg,
140
                active,    listprice,     invoiceprice, gstreg,
141
                listincgst,invoiceincgst, gstrate,      discount, notes,
141
                listincgst,invoiceincgst, tax_rate,      discount, notes,
142
                deliverytime
142
                deliverytime
143
            )
143
            )
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
Lines 153-159 sub AddBookseller { Link Here
153
        $data->{'active'},       $data->{'listprice'},
153
        $data->{'active'},       $data->{'listprice'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
156
        $data->{'gstrate'},      $data->{'discount'},
156
        $data->{'tax_rate'},      $data->{'discount'},
157
        $data->{notes},          $data->{deliverytime},
157
        $data->{notes},          $data->{deliverytime},
158
    );
158
    );
159
159
Lines 196-202 sub ModBookseller { Link Here
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
197
            active=?,listprice=?, invoiceprice=?,
197
            active=?,listprice=?, invoiceprice=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
199
            discount=?,notes=?,gstrate=?,deliverytime=?
199
            discount=?,notes=?,tax_rate=?,deliverytime=?
200
        WHERE id=?';
200
        WHERE id=?';
201
    my $sth = $dbh->prepare($query);
201
    my $sth = $dbh->prepare($query);
202
    my $cnt = $sth->execute(
202
    my $cnt = $sth->execute(
Lines 209-215 sub ModBookseller { Link Here
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
211
        $data->{'discount'},     $data->{'notes'},
211
        $data->{'discount'},     $data->{'notes'},
212
        $data->{'gstrate'},      $data->{deliverytime},
212
        $data->{'tax_rate'},      $data->{deliverytime},
213
        $data->{'id'}
213
        $data->{'id'}
214
    );
214
    );
215
    $contacts ||= $data->{'contacts'};
215
    $contacts ||= $data->{'contacts'};
(-)a/acqui/addorderiso2709.pl (-3 / +3 lines)
Lines 233-239 if ($op eq ""){ Link Here
233
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
233
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
234
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
234
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
235
            $price = Koha::Number::Price->new($price)->unformat;
235
            $price = Koha::Number::Price->new($price)->unformat;
236
            $orderinfo{gstrate} = $bookseller->{gstrate};
236
            $orderinfo{tax_rate} = $bookseller->{tax_rate};
237
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
237
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
238
            if ( $bookseller->{listincgst} ) {
238
            if ( $bookseller->{listincgst} ) {
239
                if ( $c_discount ) {
239
                if ( $c_discount ) {
Lines 245-254 if ($op eq ""){ Link Here
245
                }
245
                }
246
            } else {
246
            } else {
247
                if ( $c_discount ) {
247
                if ( $c_discount ) {
248
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
248
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
249
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
249
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
250
                } else {
250
                } else {
251
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
251
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
252
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
252
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
253
                }
253
                }
254
            }
254
            }
(-)a/acqui/basket.pl (-17 / +18 lines)
Lines 300-326 if ( $op eq 'delete_confirm' ) { Link Here
300
    my @book_foot_loop;
300
    my @book_foot_loop;
301
    my %foot;
301
    my %foot;
302
    my $total_quantity = 0;
302
    my $total_quantity = 0;
303
    my $total_gste = 0;
303
    my $total_tax_excluded = 0;
304
    my $total_gsti = 0;
304
    my $total_tax_included = 0;
305
    my $total_gstvalue = 0;
305
    my $total_tax_value = 0;
306
    for my $order (@orders) {
306
    for my $order (@orders) {
307
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
308
        my $line = get_order_infos( $order, $bookseller);
307
        my $line = get_order_infos( $order, $bookseller);
309
        if ( $line->{uncertainprice} ) {
308
        if ( $line->{uncertainprice} ) {
310
            $template->param( uncertainprices => 1 );
309
            $template->param( uncertainprices => 1 );
311
        }
310
        }
312
311
312
        $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format;
313
        $line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format;
314
313
        push @books_loop, $line;
315
        push @books_loop, $line;
314
316
315
        $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
317
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
316
        $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
318
        $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
317
        $total_gstvalue += $$line{gstvalue};
319
        $total_tax_value += $$line{tax_value};
318
        $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
320
        $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
319
        $total_quantity += $$line{quantity};
321
        $total_quantity += $$line{quantity};
320
        $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
322
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
321
        $total_gste += $$line{totalgste};
323
        $total_tax_excluded += $$line{total_tax_excluded};
322
        $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
324
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
323
        $total_gsti += $$line{totalgsti};
325
        $total_tax_included += $$line{total_tax_included};
324
    }
326
    }
325
327
326
    push @book_foot_loop, map {$_} values %foot;
328
    push @book_foot_loop, map {$_} values %foot;
Lines 329-335 if ( $op eq 'delete_confirm' ) { Link Here
329
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
331
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
330
    my @cancelledorders_loop;
332
    my @cancelledorders_loop;
331
    for my $order (@cancelledorders) {
333
    for my $order (@cancelledorders) {
332
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
333
        my $line = get_order_infos( $order, $bookseller);
334
        my $line = get_order_infos( $order, $bookseller);
334
        push @cancelledorders_loop, $line;
335
        push @cancelledorders_loop, $line;
335
    }
336
    }
Lines 381-389 if ( $op eq 'delete_confirm' ) { Link Here
381
        book_foot_loop       => \@book_foot_loop,
382
        book_foot_loop       => \@book_foot_loop,
382
        cancelledorders_loop => \@cancelledorders_loop,
383
        cancelledorders_loop => \@cancelledorders_loop,
383
        total_quantity       => $total_quantity,
384
        total_quantity       => $total_quantity,
384
        total_gste           => sprintf( "%.2f", $total_gste ),
385
        total_tax_excluded   => $total_tax_excluded,
385
        total_gsti           => sprintf( "%.2f", $total_gsti ),
386
        total_tax_included   => $total_tax_included,
386
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
387
        total_tax_value       => $total_tax_value,
387
        currency             => $cur->{'currency'},
388
        currency             => $cur->{'currency'},
388
        listincgst           => $bookseller->{listincgst},
389
        listincgst           => $bookseller->{listincgst},
389
        basketgroups         => $basketgroups,
390
        basketgroups         => $basketgroups,
Lines 410-416 sub get_order_infos { Link Here
410
    $line{budget_name}    = $budget->{budget_name};
411
    $line{budget_name}    = $budget->{budget_name};
411
412
412
    if ( $line{uncertainprice} ) {
413
    if ( $line{uncertainprice} ) {
413
        $line{rrpgste} .= ' (Uncertain)';
414
        $line{rrp_tax_excluded} .= ' (Uncertain)';
414
    }
415
    }
415
    if ( $line{'title'} ) {
416
    if ( $line{'title'} ) {
416
        my $volume      = $order->{'volume'};
417
        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 115-142 my $orders = $details->{'orders'}; Link Here
115
my @foot_loop;
115
my @foot_loop;
116
my %foot;
116
my %foot;
117
my $total_quantity = 0;
117
my $total_quantity = 0;
118
my $total_gste = 0;
118
my $total_tax_excluded = 0;
119
my $total_gsti = 0;
119
my $total_tax_included = 0;
120
my $total_gstvalue = 0;
120
my $total_tax_value = 0;
121
foreach my $order (@$orders) {
121
foreach my $order (@$orders) {
122
    $order = C4::Acquisition::populate_order_with_prices(
123
        {
124
            order        => $order,
125
            booksellerid => $bookseller->{id},
126
            receiving    => 1,
127
        }
128
    );
129
    my $line = get_infos( $order, $bookseller);
122
    my $line = get_infos( $order, $bookseller);
130
123
131
    $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
124
    $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format;
132
    $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
125
    $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format;
133
    $total_gstvalue += $$line{gstvalue};
126
134
    $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
127
    $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
128
    $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
129
    $total_tax_value += $$line{tax_value};
130
    $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
135
    $total_quantity += $$line{quantity};
131
    $total_quantity += $$line{quantity};
136
    $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
132
    $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
137
    $total_gste += $$line{totalgste};
133
    $total_tax_excluded += $$line{total_tax_excluded};
138
    $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
134
    $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
139
    $total_gsti += $$line{totalgsti};
135
    $total_tax_included += $$line{total_tax_included};
140
136
141
    $line->{orderline} = $line->{parent_ordernumber};
137
    $line->{orderline} = $line->{parent_ordernumber};
142
    push @orders_loop, $line;
138
    push @orders_loop, $line;
Lines 171-181 $template->param( Link Here
171
    orders_loop      => \@orders_loop,
167
    orders_loop      => \@orders_loop,
172
    foot_loop        => \@foot_loop,
168
    foot_loop        => \@foot_loop,
173
    total_quantity   => $total_quantity,
169
    total_quantity   => $total_quantity,
174
    total_gste       => sprintf( $format, $total_gste ),
170
    total_tax_excluded       => sprintf( $format, $total_tax_excluded ),
175
    total_gsti       => sprintf( $format, $total_gsti ),
171
    total_tax_included       => sprintf( $format, $total_tax_included ),
176
    total_gstvalue   => sprintf( $format, $total_gstvalue ),
172
    total_tax_value   => sprintf( $format, $total_tax_value ),
177
    total_gste_shipment => sprintf( $format, $total_gste + $details->{shipmentcost}),
173
    total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}),
178
    total_gsti_shipment => sprintf( $format, $total_gsti + $details->{shipmentcost}),
174
    total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}),
179
    invoiceincgst    => $bookseller->{invoiceincgst},
175
    invoiceincgst    => $bookseller->{invoiceincgst},
180
    currency         => GetCurrency()->{currency},
176
    currency         => GetCurrency()->{currency},
181
    budgets_loop     => \@budgets_loop,
177
    budgets_loop     => \@budgets_loop,
(-)a/acqui/neworderempty.pl (-2 / +2 lines)
Lines 312-318 if ( defined $subscriptionid ) { Link Here
312
        $budget_id              = $lastOrderReceived->{budgetid};
312
        $budget_id              = $lastOrderReceived->{budgetid};
313
        $data->{listprice}      = $lastOrderReceived->{listprice};
313
        $data->{listprice}      = $lastOrderReceived->{listprice};
314
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
314
        $data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
315
        $data->{gstrate}        = $lastOrderReceived->{gstrate};
315
        $data->{tax_rate}        = $lastOrderReceived->{tax_rate};
316
        $data->{discount}       = $lastOrderReceived->{discount};
316
        $data->{discount}       = $lastOrderReceived->{discount};
317
        $data->{rrp}            = $lastOrderReceived->{rrp};
317
        $data->{rrp}            = $lastOrderReceived->{rrp};
318
        $data->{ecost}          = $lastOrderReceived->{ecost};
318
        $data->{ecost}          = $lastOrderReceived->{ecost};
Lines 394-400 $template->param( Link Here
394
    quantityrec      => $quantity,
394
    quantityrec      => $quantity,
395
    rrp              => $data->{'rrp'},
395
    rrp              => $data->{'rrp'},
396
    gst_values       => \@gst_values,
396
    gst_values       => \@gst_values,
397
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
397
    tax_rate          => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
398
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
398
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
399
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
399
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
400
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
400
    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 99-109 sub printorders { Link Here
99
                $basket->{basketno},
99
                $basket->{basketno},
100
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
100
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
101
                $line->{quantity},
101
                $line->{quantity},
102
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
102
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
103
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{discount} )->format . '%',
104
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
105
                Koha::Number::Price->new( $line->{totalgste} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
106
                Koha::Number::Price->new( $line->{totalgsti} )->format,
106
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
107
            );
107
            );
108
            push(@$abaskets, $arrbasket);
108
            push(@$abaskets, $arrbasket);
109
        }
109
        }
(-)a/acqui/pdfformat/layout2pagesde.pm (-4 / +4 lines)
Lines 99-109 sub printorders { Link Here
99
                $basket->{basketno},
99
                $basket->{basketno},
100
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
100
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
101
                $line->{quantity},
101
                $line->{quantity},
102
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
102
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
103
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{discount} )->format . '%',
104
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
105
                Koha::Number::Price->new( $line->{totalgste} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
106
                Koha::Number::Price->new( $line->{totalgsti} )->format,
106
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
107
            );
107
            );
108
            push(@$abaskets, $arrbasket);
108
            push(@$abaskets, $arrbasket);
109
        }
109
        }
(-)a/acqui/pdfformat/layout3pages.pm (-30 / +30 lines)
Lines 118-130 sub printorders { Link Here
118
            push( @$arrbasket,
118
            push( @$arrbasket,
119
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
119
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
120
                $line->{quantity},
120
                $line->{quantity},
121
                Koha::Number::Price->new( $line->{rrpgste} )->format,
121
                Koha::Number::Price->new( $line->{rrp_tax_excluded} )->format,
122
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
122
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
123
                Koha::Number::Price->new( $line->{discount} )->format . '%',
123
                Koha::Number::Price->new( $line->{discount} )->format . '%',
124
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
124
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
125
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
125
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
126
                Koha::Number::Price->new( $line->{totalgste} )->format,
126
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
127
                Koha::Number::Price->new( $line->{totalgsti} )->format,
127
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
128
            );
128
            );
129
            push(@$abaskets, $arrbasket);
129
            push(@$abaskets, $arrbasket);
130
        }
130
        }
Lines 210-252 sub printbaskets { Link Here
210
    for my $bkey (@keys) {
210
    for my $bkey (@keys) {
211
        push(@$arrbasket, $bkey);
211
        push(@$arrbasket, $bkey);
212
    }
212
    }
213
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
213
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
214
    # calculate each basket total
214
    # calculate each basket total
215
    push(@$abaskets, $arrbasket);
215
    push(@$abaskets, $arrbasket);
216
    for my $basket (@$hbaskets) {
216
    for my $basket (@$hbaskets) {
217
        my @gst;
217
        my @gst;
218
        $arrbasket = undef;
218
        $arrbasket = undef;
219
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
219
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
220
        my $ords = $orders->{$basket->{basketno}};
220
        my $ords = $orders->{$basket->{basketno}};
221
        my $ordlength = @$ords;
221
        my $ordlength = @$ords;
222
        foreach my $ord (@$ords) {
222
        foreach my $ord (@$ords) {
223
            $totalgste += $ord->{totalgste};
223
            $total_tax_excluded += $ord->{total_tax_excluded};
224
            $totalgsti += $ord->{totalgsti};
224
            $total_tax_included += $ord->{total_tax_included};
225
            $totalgstvalue += $ord->{gstvalue};
225
            $totaltax_value += $ord->{tax_value};
226
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
226
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
227
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
227
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
228
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
228
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
229
            push @gst, $ord->{gstrate};
229
            push @gst, $ord->{tax_rate};
230
        }
230
        }
231
        @gst = uniq map { $_ * 100 } @gst;
231
        @gst = uniq map { $_ * 100 } @gst;
232
        $grandtotalrrpgste += $totalrrpgste;
232
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
233
        $grandtotalrrpgsti += $totalrrpgsti;
233
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
234
        $grandtotalgsti += $totalgsti;
234
        $grandtotal_tax_included += $total_tax_included;
235
        $grandtotalgste += $totalgste;
235
        $grandtotal_tax_excluded += $total_tax_excluded;
236
        $grandtotalgstvalue += $totalgstvalue;
236
        $grandtotaltax_value += $totaltax_value;
237
        $grandtotaldiscount += $totaldiscount;
237
        $grandtotaldiscount += $totaldiscount;
238
        my @gst_string =
238
        my @gst_string =
239
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
239
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
240
        push(@$arrbasket,
240
        push(@$arrbasket,
241
            $basket->{contractname},
241
            $basket->{contractname},
242
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
242
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
243
            Koha::Number::Price->new( $totalrrpgste )->format,
243
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
244
            Koha::Number::Price->new( $totalrrpgsti )->format,
244
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
245
            "@gst_string",
245
            "@gst_string",
246
            Koha::Number::Price->new( $totalgstvalue )->format,
246
            Koha::Number::Price->new( $totaltax_value )->format,
247
            Koha::Number::Price->new( $totaldiscount )->format,
247
            Koha::Number::Price->new( $totaldiscount )->format,
248
            Koha::Number::Price->new( $totalgste )->format,
248
            Koha::Number::Price->new( $total_tax_excluded )->format,
249
            Koha::Number::Price->new( $totalgsti )->format,
249
            Koha::Number::Price->new( $total_tax_included )->format,
250
        );
250
        );
251
        push(@$abaskets, $arrbasket);
251
        push(@$abaskets, $arrbasket);
252
    }
252
    }
Lines 255-267 sub printbaskets { Link Here
255
    push @$arrbasket,
255
    push @$arrbasket,
256
      '',
256
      '',
257
      'Total',
257
      'Total',
258
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
258
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
259
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
259
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
260
      '',
260
      '',
261
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
261
      Koha::Number::Price->new( $grandtotaltax_value )->format,
262
      Koha::Number::Price->new( $grandtotaldiscount )->format,
262
      Koha::Number::Price->new( $grandtotaldiscount )->format,
263
      Koha::Number::Price->new( $grandtotalgste )->format,
263
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
264
      Koha::Number::Price->new( $grandtotalgsti )->format;
264
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
265
    push @$abaskets,$arrbasket;
265
    push @$abaskets,$arrbasket;
266
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
266
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
267
267
(-)a/acqui/pdfformat/layout3pagesfr.pm (-30 / +30 lines)
Lines 118-130 sub printorders { Link Here
118
            push( @$arrbasket,
118
            push( @$arrbasket,
119
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
119
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
120
                $line->{quantity},
120
                $line->{quantity},
121
                Koha::Number::Price->new( $line->{rrpgste})->format,
121
                Koha::Number::Price->new( $line->{rrp_tax_excluded})->format,
122
                Koha::Number::Price->new( $line->{rrpgsti})->format,
122
                Koha::Number::Price->new( $line->{rrp_tax_included})->format,
123
                Koha::Number::Price->new( $line->{discount})->format.'%',
123
                Koha::Number::Price->new( $line->{discount})->format.'%',
124
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
124
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
125
                Koha::Number::Price->new( $line->{gstrate} * 100)->format.'%',
125
                Koha::Number::Price->new( $line->{tax_rate} * 100)->format.'%',
126
                Koha::Number::Price->new( $line->{totalgste})->format,
126
                Koha::Number::Price->new( $line->{total_tax_excluded})->format,
127
                Koha::Number::Price->new( $line->{totalgsti})->format,
127
                Koha::Number::Price->new( $line->{total_tax_included})->format,
128
            );
128
            );
129
            push(@$abaskets, $arrbasket);
129
            push(@$abaskets, $arrbasket);
130
        }
130
        }
Lines 210-252 sub printbaskets { Link Here
210
    for my $bkey (@keys) {
210
    for my $bkey (@keys) {
211
        push(@$arrbasket, $bkey);
211
        push(@$arrbasket, $bkey);
212
    }
212
    }
213
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
213
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
214
    # calculate each basket total
214
    # calculate each basket total
215
    push(@$abaskets, $arrbasket);
215
    push(@$abaskets, $arrbasket);
216
    for my $basket (@$hbaskets) {
216
    for my $basket (@$hbaskets) {
217
        my @gst;
217
        my @gst;
218
        $arrbasket = undef;
218
        $arrbasket = undef;
219
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
219
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
220
        my $ords = $orders->{$basket->{basketno}};
220
        my $ords = $orders->{$basket->{basketno}};
221
        my $ordlength = @$ords;
221
        my $ordlength = @$ords;
222
        foreach my $ord (@$ords) {
222
        foreach my $ord (@$ords) {
223
            $totalgste += $ord->{totalgste};
223
            $total_tax_excluded += $ord->{total_tax_excluded};
224
            $totalgsti += $ord->{totalgsti};
224
            $total_tax_included += $ord->{total_tax_included};
225
            $totalgstvalue += $ord->{gstvalue};
225
            $totaltax_value += $ord->{tax_value};
226
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
226
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
227
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
227
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
228
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
228
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
229
            push @gst, $ord->{gstrate};
229
            push @gst, $ord->{tax_rate};
230
        }
230
        }
231
        @gst = uniq map { $_ * 100 } @gst;
231
        @gst = uniq map { $_ * 100 } @gst;
232
        $grandtotalrrpgste += $totalrrpgste;
232
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
233
        $grandtotalrrpgsti += $totalrrpgsti;
233
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
234
        $grandtotalgsti += $totalgsti;
234
        $grandtotal_tax_included += $total_tax_included;
235
        $grandtotalgste += $totalgste;
235
        $grandtotal_tax_excluded += $total_tax_excluded;
236
        $grandtotalgstvalue += $totalgstvalue;
236
        $grandtotaltax_value += $totaltax_value;
237
        $grandtotaldiscount += $totaldiscount;
237
        $grandtotaldiscount += $totaldiscount;
238
        my @gst_string =
238
        my @gst_string =
239
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
239
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
240
        push(@$arrbasket,
240
        push(@$arrbasket,
241
            $basket->{contractname},
241
            $basket->{contractname},
242
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
242
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
243
            Koha::Number::Price->new( $totalrrpgste )->format,
243
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
244
            Koha::Number::Price->new( $totalrrpgsti )->format,
244
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
245
            "@gst_string",
245
            "@gst_string",
246
            Koha::Number::Price->new( $totalgstvalue )->format,
246
            Koha::Number::Price->new( $totaltax_value )->format,
247
            Koha::Number::Price->new( $totaldiscount )->format,
247
            Koha::Number::Price->new( $totaldiscount )->format,
248
            Koha::Number::Price->new( $totalgste )->format,
248
            Koha::Number::Price->new( $total_tax_excluded )->format,
249
            Koha::Number::Price->new( $totalgsti )->format,
249
            Koha::Number::Price->new( $total_tax_included )->format,
250
        );
250
        );
251
        push(@$abaskets, $arrbasket);
251
        push(@$abaskets, $arrbasket);
252
    }
252
    }
Lines 255-267 sub printbaskets { Link Here
255
    push @$arrbasket,
255
    push @$arrbasket,
256
      '',
256
      '',
257
      'Total',
257
      'Total',
258
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
258
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
259
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
259
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
260
      '',
260
      '',
261
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
261
      Koha::Number::Price->new( $grandtotaltax_value )->format,
262
      Koha::Number::Price->new( $grandtotaldiscount )->format,
262
      Koha::Number::Price->new( $grandtotaldiscount )->format,
263
      Koha::Number::Price->new( $grandtotalgste )->format,
263
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
264
      Koha::Number::Price->new( $grandtotalgsti )->format;
264
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
265
    push @$abaskets,$arrbasket;
265
    push @$abaskets,$arrbasket;
266
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
266
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
267
267
(-)a/acqui/supplier.pl (-2 / +2 lines)
Lines 82-88 if ( $op eq 'display' ) { Link Here
82
82
83
    $template->param(
83
    $template->param(
84
        active        => $supplier->{'active'},
84
        active        => $supplier->{'active'},
85
        gstrate       => $supplier->{'gstrate'} + 0.0,
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
86
        invoiceprice  => $supplier->{'invoiceprice'},
86
        invoiceprice  => $supplier->{'invoiceprice'},
87
        listprice     => $supplier->{'listprice'},
87
        listprice     => $supplier->{'listprice'},
88
        basketcount   => $supplier->{'basketcount'},
88
        basketcount   => $supplier->{'basketcount'},
Lines 126-132 if ( $op eq 'display' ) { Link Here
126
    $template->param(
126
    $template->param(
127
        # set active ON by default for supplier add (id empty for add)
127
        # set active ON by default for supplier add (id empty for add)
128
        active       => $booksellerid ? $supplier->{'active'} : 1,
128
        active       => $booksellerid ? $supplier->{'active'} : 1,
129
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
129
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
130
        gst_values    => \@gst_values,
130
        gst_values    => \@gst_values,
131
        loop_currency => $loop_currency,
131
        loop_currency => $loop_currency,
132
        enter         => 1,
132
        enter         => 1,
(-)a/acqui/updatesupplier.pl (-2 / +2 lines)
Lines 39-45 Here is the list : Link Here
39
supplier, id, company, company_postal, physical, company_phone,
39
supplier, id, company, company_postal, physical, company_phone,
40
physical, company_phone, company_fax, website, company_email, notes,
40
physical, company_phone, company_fax, website, company_email, notes,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
42
discount, gstrate, contact_name, contact_position, contact_phone,
42
discount, tax_rate, contact_name, contact_position, contact_phone,
43
contact_altphone, contact_fax, contact_email, contact_notes,
43
contact_altphone, contact_fax, contact_email, contact_notes,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
45
contact_serialsprimary.
45
contact_serialsprimary.
Lines 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 382-394 Link Here
382
                    <tr>
382
                    <tr>
383
                        <th>No.</th>
383
                        <th>No.</th>
384
                        <th>Order</th>
384
                        <th>Order</th>
385
                        <th class="gste">RRP tax exc.</th>
385
                        <th class="tax_excluded">RRP tax exc.</th>
386
                        <th class="gste">ecost tax exc.</th>
386
                        <th class="tax_excluded">ecost tax exc.</th>
387
                        <th class="gsti">RRP tax inc.</th>
387
                        <th class="tax_included">RRP tax inc.</th>
388
                        <th class="gsti">ecost tax inc.</th>
388
                        <th class="tax_included">ecost tax inc.</th>
389
                        <th>Qty.</th>
389
                        <th>Qty.</th>
390
                        <th class="gste">Total tax exc. ([% currency %])</th>
390
                        <th class="tax_excluded">Total tax exc. ([% currency %])</th>
391
                        <th class="gsti">Total tax inc. ([% currency %])</th>
391
                        <th class="tax_included">Total tax inc. ([% currency %])</th>
392
                        <th>GST %</th>
392
                        <th>GST %</th>
393
                        <th>GST</th>
393
                        <th>GST</th>
394
                        <th>Fund</th>
394
                        <th>Fund</th>
Lines 404-419 Link Here
404
                [% FOREACH foot_loo IN book_foot_loop %]
404
                [% FOREACH foot_loo IN book_foot_loop %]
405
                    <tr>
405
                    <tr>
406
                        <th></th>
406
                        <th></th>
407
                        <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
407
                        <th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
408
                        <th class="gste">&nbsp;</th>
408
                        <th class="tax_excluded">&nbsp;</th>
409
                        <th class="gste">&nbsp;</th>
409
                        <th class="tax_excluded">&nbsp;</th>
410
                        <th class="gsti">&nbsp;</th>
410
                        <th class="tax_included">&nbsp;</th>
411
                        <th class="gsti">&nbsp;</th>
411
                        <th class="tax_included">&nbsp;</th>
412
                        <th>[% foot_loo.quantity %]</th>
412
                        <th>[% foot_loo.quantity %]</th>
413
                        <th class="gste">[% foot_loo.totalgste | $Price%]</th>
413
                        <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
414
                        <th class="gsti">[% foot_loo.totalgsti | $Price %]</th>
414
                        <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
415
                        <th>&nbsp;</th>
415
                        <th>&nbsp;</th>
416
                        <th>[% foot_loo.gstvalue | $Price %]</th>
416
                        <th>[% foot_loo.tax_value | $Price %]</th>
417
                        <th>&nbsp;</th>
417
                        <th>&nbsp;</th>
418
                        [% IF ( active ) %]
418
                        [% IF ( active ) %]
419
                            [% UNLESS ( closedate ) %]
419
                            [% UNLESS ( closedate ) %]
Lines 426-440 Link Here
426
                <tr>
426
                <tr>
427
                    <th></th>
427
                    <th></th>
428
                    <th>Total ([% currency %])</th>
428
                    <th>Total ([% currency %])</th>
429
                    <th class="gste">&nbsp;</th>
429
                    <th class="tax_excluded">&nbsp;</th>
430
                    <th class="gste">&nbsp;</th>
430
                    <th class="tax_excluded">&nbsp;</th>
431
                    <th class="gsti">&nbsp;</th>
431
                    <th class="tax_included">&nbsp;</th>
432
                    <th class="gsti">&nbsp;</th>
432
                    <th class="tax_included">&nbsp;</th>
433
                    <th>[% total_quantity %]</th>
433
                    <th>[% total_quantity %]</th>
434
                    <th class="gste">[% total_gste | $Price %]</th>
434
                    <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
435
                    <th class="gsti">[% total_gsti | $Price %]</th>
435
                    <th class="tax_included">[% total_tax_included | $Price %]</th>
436
                    <th>&nbsp;</th>
436
                    <th>&nbsp;</th>
437
                    <th>[% total_gstvalue | $Price %]</th>
437
                    <th>[% total_tax_value | $Price %]</th>
438
                    <th>&nbsp;</th>
438
                    <th>&nbsp;</th>
439
                    [% IF ( active ) %]
439
                    [% IF ( active ) %]
440
                        [% UNLESS ( closedate ) %]
440
                        [% UNLESS ( closedate ) %]
Lines 495-509 Link Here
495
                        </td>
495
                        </td>
496
                        [% 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 ... %]
496
                        [% 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 ... %]
497
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
497
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
498
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
498
                        <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
499
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
499
                        <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
500
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
500
                        <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
501
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
501
                        <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
502
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
502
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
503
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
503
                        <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
504
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
504
                        <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
505
                        <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
505
                        <td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
506
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
506
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
507
                        <td>[% books_loo.budget_name %]</td>
507
                        <td>[% books_loo.budget_name %]</td>
508
                        [% IF ( active ) %]
508
                        [% IF ( active ) %]
509
                            [% UNLESS ( closedate ) %]
509
                            [% UNLESS ( closedate ) %]
Lines 556-568 Link Here
556
                <tr>
556
                <tr>
557
                  <th>No.</th>
557
                  <th>No.</th>
558
                  <th>Order</th>
558
                  <th>Order</th>
559
                  <th class="gste">RRP tax exc.</th>
559
                  <th class="tax_excluded">RRP tax exc.</th>
560
                  <th class="gste">ecost tax exc.</th>
560
                  <th class="tax_excluded">ecost tax exc.</th>
561
                  <th class="gsti">RRP tax inc.</th>
561
                  <th class="tax_included">RRP tax inc.</th>
562
                  <th class="gsti">ecost tax inc.</th>
562
                  <th class="tax_included">ecost tax inc.</th>
563
                  <th>Qty.</th>
563
                  <th>Qty.</th>
564
                  <th class="gste">Total tax exc. ([% currency %])</th>
564
                  <th class="tax_excluded">Total tax exc. ([% currency %])</th>
565
                  <th class="gsti">Total tax inc. ([% currency %])</th>
565
                  <th class="tax_included">Total tax inc. ([% currency %])</th>
566
                  <th>GST %</th>
566
                  <th>GST %</th>
567
                  <th>GST</th>
567
                  <th>GST</th>
568
                  <th>Fund</th>
568
                  <th>Fund</th>
Lines 607-621 Link Here
607
                        </p>
607
                        </p>
608
                      [% END %]
608
                      [% END %]
609
                    </td>
609
                    </td>
610
                    <td class="number gste">[% order.rrpgste | $Price %]</td>
610
                    <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
611
                    <td class="number gste">[% order.ecostgste | $Price %]</td>
611
                    <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
612
                    <td class="number gsti">[% order.rrpgsti | $Price %]</td>
612
                    <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
613
                    <td class="number gsti">[% order.ecostgsti | $Price %]</td>
613
                    <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
614
                    <td class="number">[% order.quantity %]</td>
614
                    <td class="number">[% order.quantity %]</td>
615
                    <td class="number gste">[% order.totalgste | $Price %]</td>
615
                    <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
616
                    <td class="number gsti">[% order.totalgsti | $Price %]</td>
616
                    <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
617
                    <td class="number">[% order.gstrate * 100 | $Price %]</td>
617
                    <td class="number">[% order.tax_rate * 100 | $Price %]</td>
618
                    <td class="number">[% order.gstvalue | $Price %]</td>
618
                    <td class="number">[% order.tax_value | $Price %]</td>
619
                    <td>[% order.budget_name %]
619
                    <td>[% order.budget_name %]
620
                  </tr>
620
                  </tr>
621
                [% END %]
621
                [% 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 %])</th>
139
                <th class="tax_excluded">Total tax exc. ([% currency %])</th>
140
                <th class="gsti">Total tax inc. ([% currency %])</th>
140
                <th class="tax_included">Total tax inc. ([% currency %])</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 %])</th>
193
                <th colspan='2'>Total ([% currency %])</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 %])</th>
203
                <th colspan="2">Total + Shipment cost ([% currency %])</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 551-562 $(document).ready(function() Link Here
551
                <li>
551
                <li>
552
                    [% IF ( close ) %]
552
                    [% IF ( close ) %]
553
                        <span class="label">Tax rate: </span>
553
                        <span class="label">Tax rate: </span>
554
                        <input type="hidden" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
554
                        <input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate %]" />[% tax_rate %]%
555
                    [% ELSE %]
555
                    [% ELSE %]
556
                        <label for="gstrate">Tax rate: </label>
556
                        <label for="tax_rate">Tax rate: </label>
557
                        <select name="gstrate" id="gstrate" onchange="updateCosts();">
557
                        <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
558
                        [% FOREACH gst IN gst_values %]
558
                        [% FOREACH gst IN gst_values %]
559
                          [% IF ( gst.option == gstrate ) %]
559
                          [% IF ( gst.option == tax_rate ) %]
560
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
560
                            <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
561
                          [% ELSE %]
561
                          [% ELSE %]
562
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
562
                            <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
Lines 565-571 $(document).ready(function() Link Here
565
                        </select>
565
                        </select>
566
                    [% END %]
566
                    [% END %]
567
                [% ELSE %]
567
                [% ELSE %]
568
                    <input type="hidden" name="gstrate" value="0" />
568
                    <input type="hidden" name="tax_rate" value="0" />
569
                </li>
569
                </li>
570
            [% END %]
570
            [% END %]
571
            <li>
571
            <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 268-277 function delete_contact(ev) { Link Here
268
            [% IF gst_values %]
268
            [% IF gst_values %]
269
                <ol>
269
                <ol>
270
                  <li>
270
                  <li>
271
                    <label for="gstrate">Tax rate: </label>
271
                    <label for="tax_rate">Tax rate: </label>
272
                    <select name="gstrate" id="gstrate">
272
                    <select name="tax_rate" id="tax_rate">
273
                    [% FOREACH gst IN gst_values %]
273
                    [% FOREACH gst IN gst_values %]
274
                      [% IF ( gstrate == gst.option ) %]
274
                      [% IF ( tax_rate == gst.option ) %]
275
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
275
                        <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
276
                      [% ELSE %]
276
                      [% ELSE %]
277
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
277
                        <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
Lines 281-287 function delete_contact(ev) { Link Here
281
                  </li>
281
                  </li>
282
                </ol>
282
                </ol>
283
            [% ELSE %]
283
            [% ELSE %]
284
                <input type="hidden" name="gstrate" value="0" />
284
                <input type="hidden" name="tax_rate" value="0" />
285
            [% END %]
285
            [% END %]
286
            <ol>
286
            <ol>
287
            <li><label for="discount">Discount: </label>
287
            <li><label for="discount">Discount: </label>
Lines 325-331 function delete_contact(ev) { Link Here
325
                        [% END %]</p>
325
                        [% END %]</p>
326
                <p><strong>List prices are: </strong>[% listprice %]</p>
326
                <p><strong>List prices are: </strong>[% listprice %]</p>
327
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
327
                <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
328
                [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
328
                [% IF ( tax_rate ) %]<p><strong>Tax number registered: </strong>
329
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
329
                        [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
330
                <p><strong>List item price includes tax: </strong>
330
                <p><strong>List item price includes tax: </strong>
331
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
331
                        [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
Lines 334-340 function delete_contact(ev) { Link Here
334
                <p><strong>Discount: </strong>
334
                <p><strong>Discount: </strong>
335
                    [% discount | format("%.1f") %] %</p>
335
                    [% discount | format("%.1f") %] %</p>
336
                <p><strong>Tax rate: </strong>
336
                <p><strong>Tax rate: </strong>
337
                    [% 0 + gstrate * 100 | format("%.1f") %] %</p>
337
                    [% 0 + tax_rate * 100 | format("%.1f") %] %</p>
338
                [% IF deliverytime.defined %]
338
                [% IF deliverytime.defined %]
339
                    <p><strong>Delivery time: </strong>
339
                    <p><strong>Delivery time: </strong>
340
                        [% deliverytime %] days</p>
340
                        [% deliverytime %] days</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt (-1 / +1 lines)
Lines 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 43-49 for my $currency_format ( qw( US FR ) ) { Link Here
43
            invoiceid        => $invoiceid_0_0,
43
            invoiceid        => $invoiceid_0_0,
44
            rrp              => 82.00,
44
            rrp              => 82.00,
45
            ecost            => 73.80,
45
            ecost            => 73.80,
46
            gstrate          => 0.0500,
46
            tax_rate         => 0.0500,
47
            discount         => 10.0000,
47
            discount         => 10.0000,
48
            datereceived     => $today
48
            datereceived     => $today
49
        };
49
        };
Lines 58-115 for my $currency_format ( qw( US FR ) ) { Link Here
58
        # Note that this configuration is correct \o/
58
        # Note that this configuration is correct \o/
59
        compare(
59
        compare(
60
            {
60
            {
61
                got      => $order_0_0->{rrpgsti},
61
                got      => $order_0_0->{rrp_tax_included},
62
                expected => 86.10,
62
                expected => 86.10,
63
                conf     => '0 0',
63
                conf     => '0 0',
64
                field    => 'rrpgsti'
64
                field    => 'rrp_tax_included'
65
            }
65
            }
66
        );
66
        );
67
        compare(
67
        compare(
68
            {
68
            {
69
                got      => $order_0_0->{rrpgste},
69
                got      => $order_0_0->{rrp_tax_excluded},
70
                expected => 82.00,
70
                expected => 82.00,
71
                conf     => '0 0',
71
                conf     => '0 0',
72
                field    => 'rrpgste'
72
                field    => 'rrp_tax_excluded'
73
            }
73
            }
74
        );
74
        );
75
        compare(
75
        compare(
76
            {
76
            {
77
                got      => $order_0_0->{ecostgsti},
77
                got      => $order_0_0->{ecost_tax_included},
78
                expected => 77.49,
78
                expected => 77.49,
79
                conf     => '0 0',
79
                conf     => '0 0',
80
                field    => 'ecostgsti'
80
                field    => 'ecost_tax_included'
81
            }
81
            }
82
        );
82
        );
83
        compare(
83
        compare(
84
            {
84
            {
85
                got      => $order_0_0->{ecostgste},
85
                got      => $order_0_0->{ecost_tax_excluded},
86
                expected => 73.80,
86
                expected => 73.80,
87
                conf     => '0 0',
87
                conf     => '0 0',
88
                field    => 'ecostgste'
88
                field    => 'ecost_tax_excluded'
89
            }
89
            }
90
        );
90
        );
91
        compare(
91
        compare(
92
            {
92
            {
93
                got      => $order_0_0->{gstvalue},
93
                got      => $order_0_0->{tax_value},
94
                expected => 7.38,
94
                expected => 7.38,
95
                conf     => '0 0',
95
                conf     => '0 0',
96
                field    => 'gstvalue'
96
                field    => 'tax_value'
97
            }
97
            }
98
        );
98
        );
99
        compare(
99
        compare(
100
            {
100
            {
101
                got      => $order_0_0->{totalgsti},
101
                got      => $order_0_0->{total_tax_included},
102
                expected => 154.98,
102
                expected => 154.98,
103
                conf     => '0 0',
103
                conf     => '0 0',
104
                field    => 'totalgsti'
104
                field    => 'total_tax_included'
105
            }
105
            }
106
        );
106
        );
107
        compare(
107
        compare(
108
            {
108
            {
109
                got      => $order_0_0->{totalgste},
109
                got      => $order_0_0->{total_tax_excluded},
110
                expected => 147.60,
110
                expected => 147.60,
111
                conf     => '0 0',
111
                conf     => '0 0',
112
                field    => 'totalgste'
112
                field    => 'total_tax_excluded'
113
            }
113
            }
114
        );
114
        );
115
115
Lines 124-165 for my $currency_format ( qw( US FR ) ) { Link Here
124
        # Note that this configuration is correct \o/
124
        # Note that this configuration is correct \o/
125
        compare(
125
        compare(
126
            {
126
            {
127
                got      => $order_0_0->{unitpricegsti},
127
                got      => $order_0_0->{unitprice_tax_included},
128
                expected => 77.49,
128
                expected => 77.49,
129
                conf     => '0 0',
129
                conf     => '0 0',
130
                field    => 'unitpricegsti'
130
                field    => 'unitprice_tax_included'
131
            }
131
            }
132
        );
132
        );
133
        compare(
133
        compare(
134
            {
134
            {
135
                got      => $order_0_0->{unitpricegste},
135
                got      => $order_0_0->{unitprice_tax_excluded},
136
                expected => 73.80,
136
                expected => 73.80,
137
                conf     => '0 0',
137
                conf     => '0 0',
138
                field    => 'unitpricegste'
138
                field    => 'unitprice_tax_excluded'
139
            }
139
            }
140
        );
140
        );
141
        compare(
141
        compare(
142
            {
142
            {
143
                got      => $order_0_0->{gstvalue},
143
                got      => $order_0_0->{tax_value},
144
                expected => 7.38,
144
                expected => 7.38,
145
                conf     => '0 0',
145
                conf     => '0 0',
146
                field    => 'gstvalue'
146
                field    => 'tax_value'
147
            }
147
            }
148
        );
148
        );
149
        compare(
149
        compare(
150
            {
150
            {
151
                got      => $order_0_0->{totalgsti},
151
                got      => $order_0_0->{total_tax_included},
152
                expected => 154.98,
152
                expected => 154.98,
153
                conf     => '0 0',
153
                conf     => '0 0',
154
                field    => 'totalgsti'
154
                field    => 'total_tax_included'
155
            }
155
            }
156
        );
156
        );
157
        compare(
157
        compare(
158
            {
158
            {
159
                got      => $order_0_0->{totalgste},
159
                got      => $order_0_0->{total_tax_excluded},
160
                expected => 147.60,
160
                expected => 147.60,
161
                conf     => '0 0',
161
                conf     => '0 0',
162
                field    => 'totalgste'
162
                field    => 'total_tax_excluded'
163
            }
163
            }
164
        );
164
        );
165
    };
165
    };
Lines 184-190 for my $currency_format ( qw( US FR ) ) { Link Here
184
            invoiceid        => $invoiceid_1_1,
184
            invoiceid        => $invoiceid_1_1,
185
            rrp              => 82.00,
185
            rrp              => 82.00,
186
            ecost            => 73.80,
186
            ecost            => 73.80,
187
            gstrate          => 0.0500,
187
            tax_rate         => 0.0500,
188
            discount         => 10.0000,
188
            discount         => 10.0000,
189
            datereceived     => $today
189
            datereceived     => $today
190
        };
190
        };
Lines 198-258 for my $currency_format ( qw( US FR ) ) { Link Here
198
        );
198
        );
199
199
200
        # Note that this configuration is *not* correct
200
        # Note that this configuration is *not* correct
201
        # gstvalue should be 7.03 instead of 7.02
201
        # tax_value should be 7.03 instead of 7.02
202
        compare(
202
        compare(
203
            {
203
            {
204
                got      => $order_1_1->{rrpgsti},
204
                got      => $order_1_1->{rrp_tax_included},
205
                expected => 82.00,
205
                expected => 82.00,
206
                conf     => '1 1',
206
                conf     => '1 1',
207
                field    => 'rrpgsti'
207
                field    => 'rrp_tax_included'
208
            }
208
            }
209
        );
209
        );
210
        compare(
210
        compare(
211
            {
211
            {
212
                got      => $order_1_1->{rrpgste},
212
                got      => $order_1_1->{rrp_tax_excluded},
213
                expected => 78.10,
213
                expected => 78.10,
214
                conf     => '1 1',
214
                conf     => '1 1',
215
                field    => 'rrpgste'
215
                field    => 'rrp_tax_excluded'
216
            }
216
            }
217
        );
217
        );
218
        compare(
218
        compare(
219
            {
219
            {
220
                got      => $order_1_1->{ecostgsti},
220
                got      => $order_1_1->{ecost_tax_included},
221
                expected => 73.80,
221
                expected => 73.80,
222
                conf     => '1 1',
222
                conf     => '1 1',
223
                field    => 'ecostgsti'
223
                field    => 'ecost_tax_included'
224
            }
224
            }
225
        );
225
        );
226
        compare(
226
        compare(
227
            {
227
            {
228
                got      => $order_1_1->{ecostgste},
228
                got      => $order_1_1->{ecost_tax_excluded},
229
                expected => 70.29,
229
                expected => 70.29,
230
                conf     => '1 1',
230
                conf     => '1 1',
231
                field    => 'ecostgste'
231
                field    => 'ecost_tax_excluded'
232
            }
232
            }
233
        );
233
        );
234
        compare(
234
        compare(
235
            {
235
            {
236
                got      => $order_1_1->{gstvalue},
236
                got      => $order_1_1->{tax_value},
237
                expected => 7.02,
237
                expected => 7.02,
238
                conf     => '1 1',
238
                conf     => '1 1',
239
                field    => 'gstvalue'
239
                field    => 'tax_value'
240
            }
240
            }
241
        );
241
        );
242
        compare(
242
        compare(
243
            {
243
            {
244
                got      => $order_1_1->{totalgsti},
244
                got      => $order_1_1->{total_tax_included},
245
                expected => 147.60,
245
                expected => 147.60,
246
                conf     => '1 1',
246
                conf     => '1 1',
247
                field    => 'totalgsti'
247
                field    => 'total_tax_included'
248
            }
248
            }
249
        );
249
        );
250
        compare(
250
        compare(
251
            {
251
            {
252
                got      => $order_1_1->{totalgste},
252
                got      => $order_1_1->{total_tax_excluded},
253
                expected => 140.58,
253
                expected => 140.58,
254
                conf     => '1 1',
254
                conf     => '1 1',
255
                field    => 'totalgste'
255
                field    => 'total_tax_excluded'
256
            }
256
            }
257
        );
257
        );
258
258
Lines 264-308 for my $currency_format ( qw( US FR ) ) { Link Here
264
            }
264
            }
265
        );
265
        );
266
        # Note that this configuration is *not* correct!
266
        # Note that this configuration is *not* correct!
267
        # gstvalue should be 7.03
267
        # tax_value should be 7.03
268
        compare(
268
        compare(
269
            {
269
            {
270
                got      => $order_1_1->{unitpricegsti},
270
                got      => $order_1_1->{unitprice_tax_included},
271
                expected => 73.80,
271
                expected => 73.80,
272
                conf     => '1 1',
272
                conf     => '1 1',
273
                field    => 'unitpricegsti'
273
                field    => 'unitprice_tax_included'
274
            }
274
            }
275
        );
275
        );
276
        compare(
276
        compare(
277
            {
277
            {
278
                got      => $order_1_1->{unitpricegste},
278
                got      => $order_1_1->{unitprice_tax_excluded},
279
                expected => 70.29,
279
                expected => 70.29,
280
                conf     => '1 1',
280
                conf     => '1 1',
281
                field    => 'unitpricegste'
281
                field    => 'unitprice_tax_excluded'
282
            }
282
            }
283
        );
283
        );
284
        compare(
284
        compare(
285
            {
285
            {
286
                got      => $order_1_1->{gstvalue},
286
                got      => $order_1_1->{tax_value},
287
                expected => 7.02,
287
                expected => 7.02,
288
                conf     => '1 1',
288
                conf     => '1 1',
289
                field    => 'gstvalue'
289
                field    => 'tax_value'
290
            }
290
            }
291
        );
291
        );
292
        compare(
292
        compare(
293
            {
293
            {
294
                got      => $order_1_1->{totalgsti},
294
                got      => $order_1_1->{total_tax_included},
295
                expected => 147.60,
295
                expected => 147.60,
296
                conf     => '1 1',
296
                conf     => '1 1',
297
                field    => 'totalgsti'
297
                field    => 'total_tax_included'
298
            }
298
            }
299
        );
299
        );
300
        compare(
300
        compare(
301
            {
301
            {
302
                got      => $order_1_1->{totalgste},
302
                got      => $order_1_1->{total_tax_excluded},
303
                expected => 140.58,
303
                expected => 140.58,
304
                conf     => '1 1',
304
                conf     => '1 1',
305
                field    => 'totalgste'
305
                field    => 'total_tax_excluded'
306
            }
306
            }
307
        );
307
        );
308
    };
308
    };
Lines 327-333 for my $currency_format ( qw( US FR ) ) { Link Here
327
            invoiceid        => $invoiceid_1_1,
327
            invoiceid        => $invoiceid_1_1,
328
            rrp              => 82.01,
328
            rrp              => 82.01,
329
            ecost            => 73.80,
329
            ecost            => 73.80,
330
            gstrate          => 0.0500,
330
            tax_rate         => 0.0500,
331
            discount         => 10.0000,
331
            discount         => 10.0000,
332
            datereceived     => $today
332
            datereceived     => $today
333
        };
333
        };
Lines 341-404 for my $currency_format ( qw( US FR ) ) { Link Here
341
        );
341
        );
342
342
343
        # Note that this configuration is *not* correct!
343
        # Note that this configuration is *not* correct!
344
        # rrp gsti should be 82 (what we inserted!)
344
        # rrp_tax_included should be 82 (what we inserted!)
345
        # => Actually we need to fix the inserted value (here we have 82.01 in DB)
345
        # tax_value should be 7.03 instead of 7.02
346
        # gstvalue should be 7.03 instead of 7.02
347
346
348
        compare(
347
        compare(
349
            {
348
            {
350
                got      => $order_1_0->{rrpgsti},
349
                got      => $order_1_0->{rrp_tax_included},
351
                expected => 82.01,
350
                expected => 82.01,
352
                conf     => '1 0',
351
                conf     => '1 0',
353
                field    => 'rrpgsti'
352
                field    => 'rrp_tax_included'
354
            }
353
            }
355
        );
354
        );
356
        compare(
355
        compare(
357
            {
356
            {
358
                got      => $order_1_0->{rrpgste},
357
                got      => $order_1_0->{rrp_tax_excluded},
359
                expected => 78.10,
358
                expected => 78.10,
360
                conf     => '1 0',
359
                conf     => '1 0',
361
                field    => 'rrpgste'
360
                field    => 'rrp_tax_excluded'
362
            }
361
            }
363
        );
362
        );
364
        compare(
363
        compare(
365
            {
364
            {
366
                got      => $order_1_0->{ecostgsti},
365
                got      => $order_1_0->{ecost_tax_included},
367
                expected => 73.80,
366
                expected => 73.80,
368
                conf     => '1 0',
367
                conf     => '1 0',
369
                field    => 'ecostgsti'
368
                field    => 'ecost_tax_included'
370
            }
369
            }
371
        );
370
        );
372
        compare(
371
        compare(
373
            {
372
            {
374
                got      => $order_1_0->{ecostgste},
373
                got      => $order_1_0->{ecost_tax_excluded},
375
                expected => 70.29,
374
                expected => 70.29,
376
                conf     => '1 0',
375
                conf     => '1 0',
377
                field    => 'ecostgste'
376
                field    => 'ecost_tax_excluded'
378
            }
377
            }
379
        );
378
        );
380
        compare(
379
        compare(
381
            {
380
            {
382
                got      => $order_1_0->{gstvalue},
381
                got      => $order_1_0->{tax_value},
383
                expected => 7.02,
382
                expected => 7.02,
384
                conf     => '1 0',
383
                conf     => '1 0',
385
                field    => 'gstvalue'
384
                field    => 'tax_value'
386
            }
385
            }
387
        );
386
        );
388
        compare(
387
        compare(
389
            {
388
            {
390
                got      => $order_1_0->{totalgsti},
389
                got      => $order_1_0->{total_tax_included},
391
                expected => 147.60,
390
                expected => 147.60,
392
                conf     => '1 0',
391
                conf     => '1 0',
393
                field    => 'totalgsti'
392
                field    => 'total_tax_included'
394
            }
393
            }
395
        );
394
        );
396
        compare(
395
        compare(
397
            {
396
            {
398
                got      => $order_1_0->{totalgste},
397
                got      => $order_1_0->{total_tax_excluded},
399
                expected => 140.58,
398
                expected => 140.58,
400
                conf     => '1 0',
399
                conf     => '1 0',
401
                field    => 'totalgste'
400
                field    => 'total_tax_excluded'
402
            }
401
            }
403
        );
402
        );
404
403
Lines 413-454 for my $currency_format ( qw( US FR ) ) { Link Here
413
        # gstvalue should be 7.03
412
        # gstvalue should be 7.03
414
        compare(
413
        compare(
415
            {
414
            {
416
                got      => $order_1_0->{unitpricegsti},
415
                got      => $order_1_0->{unitprice_tax_included},
417
                expected => 73.80,
416
                expected => 73.80,
418
                conf     => '1 0',
417
                conf     => '1 0',
419
                field    => 'unitpricegsti'
418
                field    => 'unitprice_tax_included'
420
            }
419
            }
421
        );
420
        );
422
        compare(
421
        compare(
423
            {
422
            {
424
                got      => $order_1_0->{unitpricegste},
423
                got      => $order_1_0->{unitprice_tax_excluded},
425
                expected => 70.29,
424
                expected => 70.29,
426
                conf     => '1 0',
425
                conf     => '1 0',
427
                field    => 'unitpricegste'
426
                field    => 'unitprice_tax_excluded'
428
            }
427
            }
429
        );
428
        );
430
        compare(
429
        compare(
431
            {
430
            {
432
                got      => $order_1_0->{gstvalue},
431
                got      => $order_1_0->{tax_value},
433
                expected => 7.02,
432
                expected => 7.02,
434
                conf     => '1 0',
433
                conf     => '1 0',
435
                field    => 'gstvalue'
434
                field    => 'tax_value'
436
            }
435
            }
437
        );
436
        );
438
        compare(
437
        compare(
439
            {
438
            {
440
                got      => $order_1_0->{totalgsti},
439
                got      => $order_1_0->{total_tax_included},
441
                expected => 147.60,
440
                expected => 147.60,
442
                conf     => '1 0',
441
                conf     => '1 0',
443
                field    => 'totalgsti'
442
                field    => 'total_tax_included'
444
            }
443
            }
445
        );
444
        );
446
        compare(
445
        compare(
447
            {
446
            {
448
                got      => $order_1_0->{totalgste},
447
                got      => $order_1_0->{total_tax_excluded},
449
                expected => 140.58,
448
                expected => 140.58,
450
                conf     => '1 0',
449
                conf     => '1 0',
451
                field    => 'totalgste'
450
                field    => 'total_tax_excluded'
452
            }
451
            }
453
        );
452
        );
454
    };
453
    };
Lines 473-479 for my $currency_format ( qw( US FR ) ) { Link Here
473
            invoiceid        => $invoiceid_1_1,
472
            invoiceid        => $invoiceid_1_1,
474
            rrp              => 82.00,
473
            rrp              => 82.00,
475
            ecost            => 73.80,
474
            ecost            => 73.80,
476
            gstrate          => 0.0500,
475
            tax_rate         => 0.0500,
477
            discount         => 10.0000,
476
            discount         => 10.0000,
478
            datereceived     => $today
477
            datereceived     => $today
479
        };
478
        };
Lines 489-546 for my $currency_format ( qw( US FR ) ) { Link Here
489
        # Note that this configuration is correct \o/
488
        # Note that this configuration is correct \o/
490
        compare(
489
        compare(
491
            {
490
            {
492
                got      => $order_0_1->{rrpgsti},
491
                got      => $order_0_1->{rrp_tax_included},
493
                expected => 86.10,
492
                expected => 86.10,
494
                conf     => '1 0',
493
                conf     => '1 0',
495
                field    => 'rrpgsti'
494
                field    => 'rrp_tax_included'
496
            }
495
            }
497
        );
496
        );
498
        compare(
497
        compare(
499
            {
498
            {
500
                got      => $order_0_1->{rrpgste},
499
                got      => $order_0_1->{rrp_tax_excluded},
501
                expected => 82.00,
500
                expected => 82.00,
502
                conf     => '1 0',
501
                conf     => '1 0',
503
                field    => 'rrpgste'
502
                field    => 'rrp_tax_excluded'
504
            }
503
            }
505
        );
504
        );
506
        compare(
505
        compare(
507
            {
506
            {
508
                got      => $order_0_1->{ecostgsti},
507
                got      => $order_0_1->{ecost_tax_included},
509
                expected => 77.49,
508
                expected => 77.49,
510
                conf     => '1 0',
509
                conf     => '1 0',
511
                field    => 'ecostgsti'
510
                field    => 'ecost_tax_included'
512
            }
511
            }
513
        );
512
        );
514
        compare(
513
        compare(
515
            {
514
            {
516
                got      => $order_0_1->{ecostgste},
515
                got      => $order_0_1->{ecost_tax_excluded},
517
                expected => 73.80,
516
                expected => 73.80,
518
                conf     => '1 0',
517
                conf     => '1 0',
519
                field    => 'ecostgste'
518
                field    => 'ecost_tax_excluded'
520
            }
519
            }
521
        );
520
        );
522
        compare(
521
        compare(
523
            {
522
            {
524
                got      => $order_0_1->{gstvalue},
523
                got      => $order_0_1->{tax_value},
525
                expected => 7.38,
524
                expected => 7.38,
526
                conf     => '1 0',
525
                conf     => '1 0',
527
                field    => 'gstvalue'
526
                field    => 'tax_value'
528
            }
527
            }
529
        );
528
        );
530
        compare(
529
        compare(
531
            {
530
            {
532
                got      => $order_0_1->{totalgsti},
531
                got      => $order_0_1->{total_tax_included},
533
                expected => 154.98,
532
                expected => 154.98,
534
                conf     => '1 0',
533
                conf     => '1 0',
535
                field    => 'totalgsti'
534
                field    => 'total_tax_included'
536
            }
535
            }
537
        );
536
        );
538
        compare(
537
        compare(
539
            {
538
            {
540
                got      => $order_0_1->{totalgste},
539
                got      => $order_0_1->{total_tax_excluded},
541
                expected => 147.60,
540
                expected => 147.60,
542
                conf     => '1 0',
541
                conf     => '1 0',
543
                field    => 'totalgste'
542
                field    => 'total_tax_excluded'
544
            }
543
            }
545
        );
544
        );
546
545
Lines 554-595 for my $currency_format ( qw( US FR ) ) { Link Here
554
        # Note that this configuration is correct
553
        # Note that this configuration is correct
555
        compare(
554
        compare(
556
            {
555
            {
557
                got      => $order_0_1->{unitpricegsti},
556
                got      => $order_0_1->{unitprice_tax_included},
558
                expected => 77.49,
557
                expected => 77.49,
559
                conf     => '0 1',
558
                conf     => '0 1',
560
                field    => 'unitpricegsti'
559
                field    => 'unitprice_tax_included'
561
            }
560
            }
562
        );
561
        );
563
        compare(
562
        compare(
564
            {
563
            {
565
                got      => $order_0_1->{unitpricegste},
564
                got      => $order_0_1->{unitprice_tax_excluded},
566
                expected => 73.80,
565
                expected => 73.80,
567
                conf     => '0 1',
566
                conf     => '0 1',
568
                field    => 'unitpricegste'
567
                field    => 'unitprice_tax_excluded'
569
            }
568
            }
570
        );
569
        );
571
        compare(
570
        compare(
572
            {
571
            {
573
                got      => $order_0_1->{gstvalue},
572
                got      => $order_0_1->{tax_value},
574
                expected => 7.38,
573
                expected => 7.38,
575
                conf     => '0 1',
574
                conf     => '0 1',
576
                field    => 'gstvalue'
575
                field    => 'tax_value'
577
            }
576
            }
578
        );
577
        );
579
        compare(
578
        compare(
580
            {
579
            {
581
                got      => $order_0_1->{totalgsti},
580
                got      => $order_0_1->{total_tax_included},
582
                expected => 154.98,
581
                expected => 154.98,
583
                conf     => '0 1',
582
                conf     => '0 1',
584
                field    => 'totalgsti'
583
                field    => 'total_tax_included'
585
            }
584
            }
586
        );
585
        );
587
        compare(
586
        compare(
588
            {
587
            {
589
                got      => $order_0_1->{totalgste},
588
                got      => $order_0_1->{total_tax_excluded},
590
                expected => 147.60,
589
                expected => 147.60,
591
                conf     => '0 1',
590
                conf     => '0 1',
592
                field    => 'totalgste'
591
                field    => 'total_tax_excluded'
593
            }
592
            }
594
        );
593
        );
595
    };
594
    };
(-)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 413-418 my @base_expectedfields = qw( Link Here
413
  notes
420
  notes
414
  ordernumber
421
  ordernumber
415
  ecost
422
  ecost
423
  ecost_tax_included
424
  ecost_tax_excluded
416
  uncertainprice
425
  uncertainprice
417
  marc
426
  marc
418
  url
427
  url
Lines 443-448 my @base_expectedfields = qw( Link Here
443
  budget_parent_id
452
  budget_parent_id
444
  publishercode
453
  publishercode
445
  unitprice
454
  unitprice
455
  unitprice_tax_included
456
  unitprice_tax_excluded
446
  collectionvolume
457
  collectionvolume
447
  budget_amount
458
  budget_amount
448
  budget_owner_id
459
  budget_owner_id
Lines 460-466 my @base_expectedfields = qw( Link Here
460
  orderstatus
471
  orderstatus
461
  agerestriction
472
  agerestriction
462
  budget_branchcode
473
  budget_branchcode
463
  gstrate
474
  tax_rate
475
  tax_value
464
  listprice
476
  listprice
465
  budget_code
477
  budget_code
466
  budgetdate
478
  budgetdate
Lines 484-489 my @base_expectedfields = qw( Link Here
484
  sort2_authcat
496
  sort2_authcat
485
  budget_expend
497
  budget_expend
486
  rrp
498
  rrp
499
  rrp_tax_included
500
  rrp_tax_excluded
487
  cn_sort
501
  cn_sort
488
  lccn
502
  lccn
489
  sort1
503
  sort1
Lines 571-583 ok( Link Here
571
  firstname
585
  firstname
572
  biblioitemnumber
586
  biblioitemnumber
573
  ecost
587
  ecost
588
  ecost_tax_included
589
  ecost_tax_excluded
574
  uncertainprice
590
  uncertainprice
575
  creationdate
591
  creationdate
576
  datereceived
592
  datereceived
577
  orderstatus
593
  orderstatus
578
  isbn
594
  isbn
579
  copyrightdate
595
  copyrightdate
580
  gstrate
596
  tax_rate
597
  tax_value
581
  serial
598
  serial
582
  listprice
599
  listprice
583
  budgetdate
600
  budgetdate
Lines 604-610 ok( Link Here
604
  unititle
621
  unititle
605
  sort2_authcat
622
  sort2_authcat
606
  rrp
623
  rrp
624
  rrp_tax_included
625
  rrp_tax_excluded
607
  unitprice
626
  unitprice
627
  unitprice_tax_included
628
  unitprice_tax_excluded
608
  sort1
629
  sort1
609
  ordernumber
630
  ordernumber
610
  datecreated
631
  datecreated
Lines 630-644 my $invoiceid = AddInvoice( Link Here
630
    unknown       => "unknown"
651
    unknown       => "unknown"
631
);
652
);
632
653
654
my $invoice = GetInvoice( $invoiceid );
655
633
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
656
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
634
    {
657
    {
635
        biblionumber      => $biblionumber4,
658
        biblionumber      => $biblionumber4,
636
        ordernumber       => $ordernumbers[4],
659
        order             => GetOrder( $ordernumbers[4] ),
637
        quantityreceived  => 1,
660
        quantityreceived  => 1,
638
        cost              => 10,
661
        invoice           => $invoice,
639
        ecost             => 10,
640
        invoiceid         => $invoiceid,
641
        rrp               => 10,
642
        budget_id          => $order_content[4]->{str}->{budget_id},
662
        budget_id          => $order_content[4]->{str}->{budget_id},
643
    }
663
    }
644
);
664
);
Lines 796-815 is( Link Here
796
    "AddClaim : Check claimed_date"
816
    "AddClaim : Check claimed_date"
797
);
817
);
798
818
819
my $order2 = GetOrder( $ordernumbers[1] );
820
$order2->{order_internalnote} = "my notes";
799
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
821
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
800
    {
822
    {
801
        biblionumber     => $biblionumber2,
823
        biblionumber     => $biblionumber2,
802
        ordernumber      => $ordernumbers[1],
824
        order            => $order2,
803
        quantityreceived => 2,
825
        quantityreceived => 2,
804
        cost             => 12,
826
        invoice          => $invoice,
805
        ecost            => 12,
806
        invoiceid        => $invoiceid,
807
        rrp              => 42,
808
        order_internalnote => "my notes",
809
        order_vendornote   => "my vendor notes",
810
    }
827
    }
811
);
828
)
812
my $order2 = GetOrder( $ordernumbers[1] );
829
;
830
$order2 = GetOrder( $ordernumbers[1] );
813
is( $order2->{'quantityreceived'},
831
is( $order2->{'quantityreceived'},
814
    0, 'Splitting up order did not receive any on original order' );
832
    0, 'Splitting up order did not receive any on original order' );
815
is( $order2->{'quantity'}, 40, '40 items on original order' );
833
is( $order2->{'quantity'}, 40, '40 items on original order' );
Lines 817-824 is( $order2->{'budget_id'}, $budgetid, Link Here
817
    'Budget on original order is unchanged' );
835
    'Budget on original order is unchanged' );
818
is( $order2->{order_internalnote}, "my notes",
836
is( $order2->{order_internalnote}, "my notes",
819
    'ModReceiveOrder and GetOrder deal with internal notes' );
837
    'ModReceiveOrder and GetOrder deal with internal notes' );
820
is( $order2->{order_vendornote}, "my vendor notes",
821
    'ModReceiveOrder and GetOrder deal with vendor notes' );
822
838
823
$neworder = GetOrder($new_ordernumber);
839
$neworder = GetOrder($new_ordernumber);
824
is( $neworder->{'quantity'}, 2, '2 items on new order' );
840
is( $neworder->{'quantity'}, 2, '2 items on new order' );
Lines 841-861 my $budgetid2 = C4::Budgets::AddBudget( Link Here
841
    }
857
    }
842
);
858
);
843
859
860
my $order3 = GetOrder( $ordernumbers[2] );
861
$order3->{order_internalnote} = "my other notes";
844
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
862
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
845
    {
863
    {
846
        biblionumber     => $biblionumber2,
864
        biblionumber     => $biblionumber2,
847
        ordernumber      => $ordernumbers[2],
865
        order            => $order3,
848
        quantityreceived => 2,
866
        quantityreceived => 2,
849
        cost             => 12,
867
        invoice          => $invoice,
850
        ecost            => 12,
851
        invoiceid        => $invoiceid,
852
        rrp              => 42,
853
        budget_id        => $budgetid2,
868
        budget_id        => $budgetid2,
854
        order_internalnote => "my other notes",
855
    }
869
    }
856
);
870
);
857
871
858
my $order3 = GetOrder( $ordernumbers[2] );
872
$order3 = GetOrder( $ordernumbers[2] );
859
is( $order3->{'quantityreceived'},
873
is( $order3->{'quantityreceived'},
860
    0, 'Splitting up order did not receive any on original order' );
874
    0, 'Splitting up order did not receive any on original order' );
861
is( $order3->{'quantity'}, 2, '2 items on original order' );
875
is( $order3->{'quantity'}, 2, '2 items on original order' );
Lines 870-886 is( $neworder->{'quantityreceived'}, Link Here
870
    2, 'Splitting up order received items on new order' );
884
    2, 'Splitting up order received items on new order' );
871
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
885
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
872
886
887
$order3 = GetOrder( $ordernumbers[2] );
888
$order3->{order_internalnote} = "my third notes";
873
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
889
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
874
    {
890
    {
875
        biblionumber     => $biblionumber2,
891
        biblionumber     => $biblionumber2,
876
        ordernumber      => $ordernumbers[2],
892
        order            => $order3,
877
        quantityreceived => 2,
893
        quantityreceived => 2,
878
        cost             => 12,
894
        invoice          => $invoice,
879
        ecost            => 12,
880
        invoiceid        => $invoiceid,
881
        rrp              => 42,
882
        budget_id        => $budgetid2,
895
        budget_id        => $budgetid2,
883
        order_internalnote => "my third notes",
884
    }
896
    }
885
);
897
);
886
898
(-)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 62-68 my $sample_supplier1 = { Link Here
62
    gstreg        => 1,
62
    gstreg        => 1,
63
    listincgst    => 1,
63
    listincgst    => 1,
64
    invoiceincgst => 1,
64
    invoiceincgst => 1,
65
    gstrate       => '1.0000',
65
    tax_rate       => '1.0000',
66
    discount      => '1.0000',
66
    discount      => '1.0000',
67
    notes         => 'notes1',
67
    notes         => 'notes1',
68
    deliverytime  => undef
68
    deliverytime  => undef
Lines 82-88 my $sample_supplier2 = { Link Here
82
    gstreg        => 1,
82
    gstreg        => 1,
83
    listincgst    => 1,
83
    listincgst    => 1,
84
    invoiceincgst => 1,
84
    invoiceincgst => 1,
85
    gstrate       => '2.0000',
85
    tax_rate       => '2.0000',
86
    discount      => '2.0000',
86
    discount      => '2.0000',
87
    notes         => 'notes2',
87
    notes         => 'notes2',
88
    deliverytime  => 2
88
    deliverytime  => 2
Lines 223-229 $sample_supplier2 = { Link Here
223
    gstreg        => 1,
223
    gstreg        => 1,
224
    listincgst    => 1,
224
    listincgst    => 1,
225
    invoiceincgst => 1,
225
    invoiceincgst => 1,
226
    gstrate       => '2.0000 ',
226
    tax_rate       => '2.0000 ',
227
    discount      => '2.0000',
227
    discount      => '2.0000',
228
    notes         => 'notes2 modified',
228
    notes         => 'notes2 modified',
229
    deliverytime  => 2,
229
    deliverytime  => 2,
Lines 263-269 my $sample_supplier3 = { Link Here
263
    gstreg        => 1,
263
    gstreg        => 1,
264
    listincgst    => 1,
264
    listincgst    => 1,
265
    invoiceincgst => 1,
265
    invoiceincgst => 1,
266
    gstrate       => '3.0000',
266
    tax_rate       => '3.0000',
267
    discount      => '3.0000',
267
    discount      => '3.0000',
268
    notes         => 'notes3',
268
    notes         => 'notes3',
269
    deliverytime  => 3
269
    deliverytime  => 3
Lines 283-289 my $sample_supplier4 = { Link Here
283
    gstreg        => 1,
283
    gstreg        => 1,
284
    listincgst    => 1,
284
    listincgst    => 1,
285
    invoiceincgst => 1,
285
    invoiceincgst => 1,
286
    gstrate       => '3.0000',
286
    tax_rate       => '3.0000',
287
    discount      => '3.0000',
287
    discount      => '3.0000',
288
    notes         => 'notes3',
288
    notes         => 'notes3',
289
};
289
};
Lines 360-366 my $order1 = Koha::Acquisition::Order->new( Link Here
360
        entrydate        => '01-01-2013',
360
        entrydate        => '01-01-2013',
361
        currency         => 'EUR',
361
        currency         => 'EUR',
362
        notes            => "This is a note1",
362
        notes            => "This is a note1",
363
        gstrate          => 0.0500,
363
        tax_rate          => 0.0500,
364
        orderstatus      => 1,
364
        orderstatus      => 1,
365
        subscriptionid   => $id_subscription1,
365
        subscriptionid   => $id_subscription1,
366
        quantityreceived => 2,
366
        quantityreceived => 2,
Lines 380-386 my $order2 = Koha::Acquisition::Order->new( Link Here
380
        entrydate      => '01-01-2013',
380
        entrydate      => '01-01-2013',
381
        currency       => 'EUR',
381
        currency       => 'EUR',
382
        notes          => "This is a note2",
382
        notes          => "This is a note2",
383
        gstrate        => 0.0500,
383
        tax_rate        => 0.0500,
384
        orderstatus    => 1,
384
        orderstatus    => 1,
385
        subscriptionid => $id_subscription2,
385
        subscriptionid => $id_subscription2,
386
        rrp            => 10,
386
        rrp            => 10,
Lines 398-404 my $order3 = Koha::Acquisition::Order->new( Link Here
398
        entrydate      => '02-02-2013',
398
        entrydate      => '02-02-2013',
399
        currency       => 'EUR',
399
        currency       => 'EUR',
400
        notes          => "This is a note3",
400
        notes          => "This is a note3",
401
        gstrate        => 0.0500,
401
        tax_rate        => 0.0500,
402
        orderstatus    => 2,
402
        orderstatus    => 2,
403
        subscriptionid => $id_subscription3,
403
        subscriptionid => $id_subscription3,
404
        rrp            => 11,
404
        rrp            => 11,
Lines 416-422 my $order4 = Koha::Acquisition::Order->new( Link Here
416
        entrydate        => '02-02-2013',
416
        entrydate        => '02-02-2013',
417
        currency         => 'EUR',
417
        currency         => 'EUR',
418
        notes            => "This is a note3",
418
        notes            => "This is a note3",
419
        gstrate          => 0.0500,
419
        tax_rate          => 0.0500,
420
        orderstatus      => 2,
420
        orderstatus      => 2,
421
        subscriptionid   => $id_subscription3,
421
        subscriptionid   => $id_subscription3,
422
        rrp              => 11,
422
        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