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

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

Return to bug 13321