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

(-)a/C4/Acquisition.pm (-111 / +101 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-1400 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 * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?},
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->{quantity} > $quantrec ) {
1374
    if ( $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),
Lines 1404-1431 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, 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->{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-1460 q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, 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( $ordernumber );
Lines 2828-2877 sub populate_order_with_prices { Link Here
2828
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2824
    $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
2829
    if ($ordering) {
2825
    if ($ordering) {
2830
        if ( $bookseller->{listincgst} ) {
2826
        if ( $bookseller->{listincgst} ) {
2831
            $order->{rrpgsti} = $order->{rrp};
2827
            $order->{rrp_tax_included} = $order->{rrp};
2832
            $order->{rrpgste} = Koha::Number::Price->new(
2828
            $order->{rrp_tax_excluded} = Koha::Number::Price->new(
2833
                $order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round;
2829
                $order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2834
            $order->{ecostgsti} = $order->{ecost};
2830
            $order->{ecost_tax_included} = $order->{ecost};
2835
            $order->{ecostgste} = Koha::Number::Price->new(
2831
            $order->{ecost_tax_excluded} = Koha::Number::Price->new(
2836
                $order->{ecost} / ( 1 + $order->{gstrate} ) )->round;
2832
                $order->{ecost} / ( 1 + $order->{tax_rate} ) )->round;
2837
            $order->{gstvalue} = Koha::Number::Price->new(
2833
            $order->{tax_value} = Koha::Number::Price->new(
2838
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2834
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2839
                  $order->{quantity} )->round;
2835
                  $order->{quantity} )->round;
2840
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2841
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2842
        }
2836
        }
2843
        else {
2837
        else {
2844
            $order->{rrpgste} = $order->{rrp};
2838
            $order->{rrp_tax_excluded} = $order->{rrp};
2845
            $order->{rrpgsti} = Koha::Number::Price->new(
2839
            $order->{rrp_tax_included} = Koha::Number::Price->new(
2846
                $order->{rrp} * ( 1 + $order->{gstrate} ) )->round;
2840
                $order->{rrp} * ( 1 + $order->{tax_rate} ) )->round;
2847
            $order->{ecostgste} = $order->{ecost};
2841
            $order->{ecost_tax_excluded} = $order->{ecost};
2848
            $order->{ecostgsti} = Koha::Number::Price->new(
2842
            $order->{ecost_tax_included} = Koha::Number::Price->new(
2849
                $order->{ecost} * ( 1 + $order->{gstrate} ) )->round;
2843
                $order->{ecost} * ( 1 + $order->{tax_rate} ) )->round;
2850
            $order->{gstvalue} = Koha::Number::Price->new(
2844
            $order->{tax_value} = Koha::Number::Price->new(
2851
                ( $order->{ecostgsti} - $order->{ecostgste} ) *
2845
                ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
2852
                  $order->{quantity} )->round;
2846
                  $order->{quantity} )->round;
2853
            $order->{totalgste} = $order->{ecostgste} * $order->{quantity};
2854
            $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
2855
        }
2847
        }
2856
    }
2848
    }
2857
2849
2858
    if ($receiving) {
2850
    if ($receiving) {
2859
        if ( $bookseller->{listincgst} ) {
2851
        if ( $bookseller->{listincgst} ) {
2860
            $order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round;
2852
            $order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round;
2861
            $order->{unitpricegste} = Koha::Number::Price->new(
2853
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new(
2862
              $order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round;
2854
              $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
2863
        }
2855
        }
2864
        else {
2856
        else {
2865
            $order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round;
2857
            $order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round;
2866
            $order->{unitpricegsti} = Koha::Number::Price->new(
2858
            $order->{unitprice_tax_included} = Koha::Number::Price->new(
2867
              $order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round;
2859
              $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round;
2868
        }
2860
        }
2869
        $order->{gstvalue} = Koha::Number::Price->new(
2861
        $order->{tax_value} = Koha::Number::Price->new(
2870
          ( $order->{unitpricegsti} - $order->{unitpricegste} )
2862
          ( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} )
2871
          * $order->{quantityreceived} )->round;
2863
          * $order->{quantityreceived} )->round;
2872
2864
2873
        $order->{totalgste} = $order->{unitpricegste} * $order->{quantity};
2874
        $order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity};
2875
    }
2865
    }
2876
2866
2877
    return $order;
2867
    return $order;
(-)a/C4/Bookseller.pm (-4 / +4 lines)
Lines 138-144 sub AddBookseller { Link Here
138
                name,      address1,      address2,     address3, address4,
138
                name,      address1,      address2,     address3, address4,
139
                postal,    phone,         accountnumber,fax,      url,
139
                postal,    phone,         accountnumber,fax,      url,
140
                active,    listprice,     invoiceprice, gstreg,
140
                active,    listprice,     invoiceprice, gstreg,
141
                listincgst,invoiceincgst, gstrate,      discount, notes,
141
                listincgst,invoiceincgst, tax_rate,      discount, notes,
142
                deliverytime
142
                deliverytime
143
            )
143
            )
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
144
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
Lines 153-159 sub AddBookseller { Link Here
153
        $data->{'active'},       $data->{'listprice'},
153
        $data->{'active'},       $data->{'listprice'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
154
        $data->{'invoiceprice'}, $data->{'gstreg'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
155
        $data->{'listincgst'},   $data->{'invoiceincgst'},
156
        $data->{'gstrate'},      $data->{'discount'},
156
        $data->{'tax_rate'},      $data->{'discount'},
157
        $data->{notes},          $data->{deliverytime},
157
        $data->{notes},          $data->{deliverytime},
158
    );
158
    );
159
159
Lines 196-202 sub ModBookseller { Link Here
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
196
            postal=?,phone=?,accountnumber=?,fax=?,url=?,
197
            active=?,listprice=?, invoiceprice=?,
197
            active=?,listprice=?, invoiceprice=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
198
            gstreg=?,listincgst=?,invoiceincgst=?,
199
            discount=?,notes=?,gstrate=?,deliverytime=?
199
            discount=?,notes=?,tax_rate=?,deliverytime=?
200
        WHERE id=?';
200
        WHERE id=?';
201
    my $sth = $dbh->prepare($query);
201
    my $sth = $dbh->prepare($query);
202
    my $cnt = $sth->execute(
202
    my $cnt = $sth->execute(
Lines 209-215 sub ModBookseller { Link Here
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
209
        $data->{'invoiceprice'}, $data->{'gstreg'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
210
        $data->{'listincgst'},   $data->{'invoiceincgst'},
211
        $data->{'discount'},     $data->{'notes'},
211
        $data->{'discount'},     $data->{'notes'},
212
        $data->{'gstrate'},      $data->{deliverytime},
212
        $data->{'tax_rate'},      $data->{deliverytime},
213
        $data->{'id'}
213
        $data->{'id'}
214
    );
214
    );
215
    $contacts ||= $data->{'contacts'};
215
    $contacts ||= $data->{'contacts'};
(-)a/acqui/addorderiso2709.pl (-3 / +3 lines)
Lines 205-211 if ($op eq ""){ Link Here
205
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
205
            # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
206
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
206
            $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
207
            $price = Koha::Number::Price->new($price)->unformat;
207
            $price = Koha::Number::Price->new($price)->unformat;
208
            $orderinfo{gstrate} = $bookseller->{gstrate};
208
            $orderinfo{tax_rate} = $bookseller->{tax_rate};
209
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
209
            my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
210
            if ( $bookseller->{listincgst} ) {
210
            if ( $bookseller->{listincgst} ) {
211
                if ( $c_discount ) {
211
                if ( $c_discount ) {
Lines 217-226 if ($op eq ""){ Link Here
217
                }
217
                }
218
            } else {
218
            } else {
219
                if ( $c_discount ) {
219
                if ( $c_discount ) {
220
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
220
                    $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
221
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
221
                    $orderinfo{rrp}   = $orderinfo{ecost} / ( 1 - $c );
222
                } else {
222
                } else {
223
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{gstrate} );
223
                    $orderinfo{rrp}   = $price / ( 1 + $orderinfo{tax_rate} );
224
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
224
                    $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
225
                }
225
                }
226
            }
226
            }
(-)a/acqui/basket.pl (-17 / +18 lines)
Lines 298-324 if ( $op eq 'delete_confirm' ) { Link Here
298
    my @book_foot_loop;
298
    my @book_foot_loop;
299
    my %foot;
299
    my %foot;
300
    my $total_quantity = 0;
300
    my $total_quantity = 0;
301
    my $total_gste = 0;
301
    my $total_tax_excluded = 0;
302
    my $total_gsti = 0;
302
    my $total_tax_included = 0;
303
    my $total_gstvalue = 0;
303
    my $total_tax_value = 0;
304
    for my $order (@orders) {
304
    for my $order (@orders) {
305
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
306
        my $line = get_order_infos( $order, $bookseller);
305
        my $line = get_order_infos( $order, $bookseller);
307
        if ( $line->{uncertainprice} ) {
306
        if ( $line->{uncertainprice} ) {
308
            $template->param( uncertainprices => 1 );
307
            $template->param( uncertainprices => 1 );
309
        }
308
        }
310
309
310
        $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format;
311
        $line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format;
312
311
        push @books_loop, $line;
313
        push @books_loop, $line;
312
314
313
        $foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
315
        $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
314
        $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
316
        $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
315
        $total_gstvalue += $$line{gstvalue};
317
        $total_tax_value += $$line{tax_value};
316
        $foot{$$line{gstrate}}{quantity}  += $$line{quantity};
318
        $foot{$$line{tax_rate}}{quantity}  += $$line{quantity};
317
        $total_quantity += $$line{quantity};
319
        $total_quantity += $$line{quantity};
318
        $foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
320
        $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
319
        $total_gste += $$line{totalgste};
321
        $total_tax_excluded += $$line{total_tax_excluded};
320
        $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
322
        $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
321
        $total_gsti += $$line{totalgsti};
323
        $total_tax_included += $$line{total_tax_included};
322
    }
324
    }
323
325
324
    push @book_foot_loop, map {$_} values %foot;
326
    push @book_foot_loop, map {$_} values %foot;
Lines 327-333 if ( $op eq 'delete_confirm' ) { Link Here
327
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
329
    my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
328
    my @cancelledorders_loop;
330
    my @cancelledorders_loop;
329
    for my $order (@cancelledorders) {
331
    for my $order (@cancelledorders) {
330
        $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
331
        my $line = get_order_infos( $order, $bookseller);
332
        my $line = get_order_infos( $order, $bookseller);
332
        push @cancelledorders_loop, $line;
333
        push @cancelledorders_loop, $line;
333
    }
334
    }
Lines 379-387 if ( $op eq 'delete_confirm' ) { Link Here
379
        book_foot_loop       => \@book_foot_loop,
380
        book_foot_loop       => \@book_foot_loop,
380
        cancelledorders_loop => \@cancelledorders_loop,
381
        cancelledorders_loop => \@cancelledorders_loop,
381
        total_quantity       => $total_quantity,
382
        total_quantity       => $total_quantity,
382
        total_gste           => sprintf( "%.2f", $total_gste ),
383
        total_tax_excluded   => $total_tax_excluded,
383
        total_gsti           => sprintf( "%.2f", $total_gsti ),
384
        total_tax_included   => $total_tax_included,
384
        total_gstvalue       => sprintf( "%.2f", $total_gstvalue ),
385
        total_tax_value      => $total_tax_value,
385
        currency             => $active_currency->currency,
386
        currency             => $active_currency->currency,
386
        listincgst           => $bookseller->{listincgst},
387
        listincgst           => $bookseller->{listincgst},
387
        basketgroups         => $basketgroups,
388
        basketgroups         => $basketgroups,
Lines 408-414 sub get_order_infos { Link Here
408
    $line{budget_name}    = $budget->{budget_name};
409
    $line{budget_name}    = $budget->{budget_name};
409
410
410
    if ( $line{uncertainprice} ) {
411
    if ( $line{uncertainprice} ) {
411
        $line{rrpgste} .= ' (Uncertain)';
412
        $line{rrp_tax_excluded} .= ' (Uncertain)';
412
    }
413
    }
413
    if ( $line{'title'} ) {
414
    if ( $line{'title'} ) {
414
        my $volume      = $order->{'volume'};
415
        my $volume      = $order->{'volume'};
(-)a/acqui/basketgroup.pl (-6 / +13 lines)
Lines 74-82 sub BasketTotal { Link Here
74
    my $total = 0;
74
    my $total = 0;
75
    my @orders = GetOrders($basketno);
75
    my @orders = GetOrders($basketno);
76
    for my $order (@orders){
76
    for my $order (@orders){
77
        $total = $total + ( $order->{ecost} * $order->{quantity} );
77
        # FIXME The following is wrong
78
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) {
78
        if ( $bookseller->{listincgst} ) {
79
            my $gst = $bookseller->{gstrate} // C4::Context->preference("gist");
79
            $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
80
        } else {
81
            $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
82
        }
83
        if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{tax_rate} // C4::Context->preference("gist") )) {
84
            my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist");
80
            $total = $total * ( $gst / 100 +1);
85
            $total = $total * ( $gst / 100 +1);
81
        }
86
        }
82
    }
87
    }
Lines 167-179 sub printbasketgrouppdf{ Link Here
167
                croak $@;
172
                croak $@;
168
            }
173
            }
169
174
170
            $ord = C4::Acquisition::populate_order_with_prices({ order => $ord, booksellerid => $bookseller->{id}, ordering => 1 });
175
            $ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity};
176
            $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
177
171
            my $bib = GetBiblioData($ord->{biblionumber});
178
            my $bib = GetBiblioData($ord->{biblionumber});
172
            my $itemtypes = GetItemTypes();
179
            my $itemtypes = GetItemTypes();
173
180
174
            #FIXME DELETE ME
181
            #FIXME DELETE ME
175
            # 0      1        2        3         4            5         6       7      8        9
182
            # 0      1        2        3         4            5         6       7      8        9
176
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate
183
            #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount tax_rate
177
184
178
            # Editor Number
185
            # Editor Number
179
            my $en;
186
            my $en;
Lines 201-207 sub printbasketgrouppdf{ Link Here
201
        -type       => 'application/pdf',
208
        -type       => 'application/pdf',
202
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
209
        -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
203
    );
210
    );
204
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed";
211
    my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed";
205
    print $pdf;
212
    print $pdf;
206
213
207
}
214
}
(-)a/acqui/finishreceive.pl (-21 / +20 lines)
Lines 56-62 my $booksellerid = $input->param('booksellerid'); Link Here
56
my $cnt              = 0;
56
my $cnt              = 0;
57
my $ecost            = $input->param('ecost');
57
my $ecost            = $input->param('ecost');
58
my $rrp              = $input->param('rrp');
58
my $rrp              = $input->param('rrp');
59
my $order_internalnote = $input->param("order_internalnote");
60
my $bookfund         = $input->param("bookfund");
59
my $bookfund         = $input->param("bookfund");
61
my $order            = GetOrder($ordernumber);
60
my $order            = GetOrder($ordernumber);
62
my $new_ordernumber  = $ordernumber;
61
my $new_ordernumber  = $ordernumber;
Lines 83-122 if ($quantityrec > $origquantityrec ) { Link Here
83
        }
82
        }
84
    }
83
    }
85
84
85
    $order->{order_internalnote} = $input->param("order_internalnote");
86
    $order->{rrp} = $rrp;
86
    $order->{rrp} = $rrp;
87
    $order->{ecost} = $ecost;
87
    $order->{ecost} = $ecost;
88
    $order->{unitprice} = $unitprice;
88
    $order->{unitprice} = $unitprice;
89
90
    # FIXME is it still useful?
89
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
91
    my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
90
    if ( $bookseller->{listincgst} ) {
92
    if ( $bookseller->{listincgst} ) {
91
        if ( not $bookseller->{invoiceincgst} ) {
93
        if ( not $bookseller->{invoiceincgst} ) {
92
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
94
            $order->{rrp} = $order->{rrp} * ( 1 + $order->{tax_rate} );
93
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
95
            $order->{ecost} = $order->{ecost} * ( 1 + $order->{tax_rate} );
94
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
96
            $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{tax_rate} );
95
        }
97
        }
96
    } else {
98
    } else {
97
        if ( $bookseller->{invoiceincgst} ) {
99
        if ( $bookseller->{invoiceincgst} ) {
98
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
100
            $order->{rrp} = $order->{rrp} / ( 1 + $order->{tax_rate} );
99
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
101
            $order->{ecost} = $order->{ecost} / ( 1 + $order->{tax_rate} );
100
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
102
            $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{tax_rate} );
101
        }
103
        }
102
    }
104
    }
103
105
104
    # save the quantity received.
106
    # save the quantity received.
105
    if ( $quantityrec > 0 ) {
107
    if ( $quantityrec > 0 ) {
106
        ($datereceived, $new_ordernumber) = ModReceiveOrder({
108
        ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
107
              biblionumber     => $biblionumber,
109
            {
108
              ordernumber      => $ordernumber,
110
                biblionumber     => $biblionumber,
109
              quantityreceived => $quantityrec,
111
                order            => $order,
110
              user             => $user,
112
                quantityreceived => $quantityrec,
111
              cost             => $order->{unitprice},
113
                user             => $user,
112
              ecost            => $order->{ecost},
114
                invoice          => $invoice,
113
              invoiceid        => $invoiceid,
115
                budget_id        => $bookfund,
114
              rrp              => $order->{rrp},
116
                received_items   => \@received_items,
115
              budget_id        => $bookfund,
117
            }
116
              datereceived     => $datereceived,
118
        );
117
              received_items   => \@received_items,
118
              order_internalnote  => $order_internalnote,
119
        } );
120
    }
119
    }
121
120
122
    # now, add items if applicable
121
    # now, add items if applicable
(-)a/acqui/invoice.pl (-23 / +19 lines)
Lines 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::Currency->get_active->currency,
177
    currency         => Koha::Acquisition::Currency->get_active->currency,
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 366-372 $template->param( Link Here
366
    quantityrec      => $quantity,
366
    quantityrec      => $quantity,
367
    rrp              => $data->{'rrp'},
367
    rrp              => $data->{'rrp'},
368
    gst_values       => \@gst_values,
368
    gst_values       => \@gst_values,
369
    gstrate          => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
369
    tax_rate          => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
370
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
370
    listprice        => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
371
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
371
    total            => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
372
    ecost            => sprintf( "%.2f", $data->{ecost} || 0),
372
    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 98-108 sub printorders { Link Here
98
                $basket->{basketno},
98
                $basket->{basketno},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
100
                $line->{quantity},
100
                $line->{quantity},
101
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
101
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
103
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{totalgste} )->format,
104
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
105
                Koha::Number::Price->new( $line->{totalgsti} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
106
            );
106
            );
107
            push(@$abaskets, $arrbasket);
107
            push(@$abaskets, $arrbasket);
108
        }
108
        }
(-)a/acqui/pdfformat/layout2pagesde.pm (-4 / +4 lines)
Lines 98-108 sub printorders { Link Here
98
                $basket->{basketno},
98
                $basket->{basketno},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
99
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ),                $line->{quantity},
100
                $line->{quantity},
100
                $line->{quantity},
101
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
101
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
102
                Koha::Number::Price->new( $line->{discount} )->format . '%',
103
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
103
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
104
                Koha::Number::Price->new( $line->{totalgste} )->format,
104
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
105
                Koha::Number::Price->new( $line->{totalgsti} )->format,
105
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
106
            );
106
            );
107
            push(@$abaskets, $arrbasket);
107
            push(@$abaskets, $arrbasket);
108
        }
108
        }
(-)a/acqui/pdfformat/layout3pages.pm (-30 / +30 lines)
Lines 119-131 sub printorders { Link Here
119
            push( @$arrbasket,
119
            push( @$arrbasket,
120
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
120
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
121
                $line->{quantity},
121
                $line->{quantity},
122
                Koha::Number::Price->new( $line->{rrpgste} )->format,
122
                Koha::Number::Price->new( $line->{rrp_tax_excluded} )->format,
123
                Koha::Number::Price->new( $line->{rrpgsti} )->format,
123
                Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
124
                Koha::Number::Price->new( $line->{discount} )->format . '%',
124
                Koha::Number::Price->new( $line->{discount} )->format . '%',
125
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
125
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
126
                Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
126
                Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
127
                Koha::Number::Price->new( $line->{totalgste} )->format,
127
                Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
128
                Koha::Number::Price->new( $line->{totalgsti} )->format,
128
                Koha::Number::Price->new( $line->{total_tax_included} )->format,
129
            );
129
            );
130
            push(@$abaskets, $arrbasket);
130
            push(@$abaskets, $arrbasket);
131
        }
131
        }
Lines 211-253 sub printbaskets { Link Here
211
    for my $bkey (@keys) {
211
    for my $bkey (@keys) {
212
        push(@$arrbasket, $bkey);
212
        push(@$arrbasket, $bkey);
213
    }
213
    }
214
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
214
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
215
    # calculate each basket total
215
    # calculate each basket total
216
    push(@$abaskets, $arrbasket);
216
    push(@$abaskets, $arrbasket);
217
    for my $basket (@$hbaskets) {
217
    for my $basket (@$hbaskets) {
218
        my @gst;
218
        my @gst;
219
        $arrbasket = undef;
219
        $arrbasket = undef;
220
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
220
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
221
        my $ords = $orders->{$basket->{basketno}};
221
        my $ords = $orders->{$basket->{basketno}};
222
        my $ordlength = @$ords;
222
        my $ordlength = @$ords;
223
        foreach my $ord (@$ords) {
223
        foreach my $ord (@$ords) {
224
            $totalgste += $ord->{totalgste};
224
            $total_tax_excluded += $ord->{total_tax_excluded};
225
            $totalgsti += $ord->{totalgsti};
225
            $total_tax_included += $ord->{total_tax_included};
226
            $totalgstvalue += $ord->{gstvalue};
226
            $totaltax_value += $ord->{tax_value};
227
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
227
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
228
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
228
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
229
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
229
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
230
            push @gst, $ord->{gstrate};
230
            push @gst, $ord->{tax_rate};
231
        }
231
        }
232
        @gst = uniq map { $_ * 100 } @gst;
232
        @gst = uniq map { $_ * 100 } @gst;
233
        $grandtotalrrpgste += $totalrrpgste;
233
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
234
        $grandtotalrrpgsti += $totalrrpgsti;
234
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
235
        $grandtotalgsti += $totalgsti;
235
        $grandtotal_tax_included += $total_tax_included;
236
        $grandtotalgste += $totalgste;
236
        $grandtotal_tax_excluded += $total_tax_excluded;
237
        $grandtotalgstvalue += $totalgstvalue;
237
        $grandtotaltax_value += $totaltax_value;
238
        $grandtotaldiscount += $totaldiscount;
238
        $grandtotaldiscount += $totaldiscount;
239
        my @gst_string =
239
        my @gst_string =
240
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
240
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
241
        push(@$arrbasket,
241
        push(@$arrbasket,
242
            $basket->{contractname},
242
            $basket->{contractname},
243
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
243
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
244
            Koha::Number::Price->new( $totalrrpgste )->format,
244
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
245
            Koha::Number::Price->new( $totalrrpgsti )->format,
245
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
246
            "@gst_string",
246
            "@gst_string",
247
            Koha::Number::Price->new( $totalgstvalue )->format,
247
            Koha::Number::Price->new( $totaltax_value )->format,
248
            Koha::Number::Price->new( $totaldiscount )->format,
248
            Koha::Number::Price->new( $totaldiscount )->format,
249
            Koha::Number::Price->new( $totalgste )->format,
249
            Koha::Number::Price->new( $total_tax_excluded )->format,
250
            Koha::Number::Price->new( $totalgsti )->format,
250
            Koha::Number::Price->new( $total_tax_included )->format,
251
        );
251
        );
252
        push(@$abaskets, $arrbasket);
252
        push(@$abaskets, $arrbasket);
253
    }
253
    }
Lines 256-268 sub printbaskets { Link Here
256
    push @$arrbasket,
256
    push @$arrbasket,
257
      '',
257
      '',
258
      'Total',
258
      'Total',
259
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
259
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
260
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
260
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
261
      '',
261
      '',
262
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
262
      Koha::Number::Price->new( $grandtotaltax_value )->format,
263
      Koha::Number::Price->new( $grandtotaldiscount )->format,
263
      Koha::Number::Price->new( $grandtotaldiscount )->format,
264
      Koha::Number::Price->new( $grandtotalgste )->format,
264
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
265
      Koha::Number::Price->new( $grandtotalgsti )->format;
265
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
266
    push @$abaskets,$arrbasket;
266
    push @$abaskets,$arrbasket;
267
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
267
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
268
268
(-)a/acqui/pdfformat/layout3pagesfr.pm (-30 / +30 lines)
Lines 119-131 sub printorders { Link Here
119
            push( @$arrbasket,
119
            push( @$arrbasket,
120
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
120
                $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
121
                $line->{quantity},
121
                $line->{quantity},
122
                Koha::Number::Price->new( $line->{rrpgste})->format,
122
                Koha::Number::Price->new( $line->{rrp_tax_excluded})->format,
123
                Koha::Number::Price->new( $line->{rrpgsti})->format,
123
                Koha::Number::Price->new( $line->{rrp_tax_included})->format,
124
                Koha::Number::Price->new( $line->{discount})->format.'%',
124
                Koha::Number::Price->new( $line->{discount})->format.'%',
125
                Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
125
                Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
126
                Koha::Number::Price->new( $line->{gstrate} * 100)->format.'%',
126
                Koha::Number::Price->new( $line->{tax_rate} * 100)->format.'%',
127
                Koha::Number::Price->new( $line->{totalgste})->format,
127
                Koha::Number::Price->new( $line->{total_tax_excluded})->format,
128
                Koha::Number::Price->new( $line->{totalgsti})->format,
128
                Koha::Number::Price->new( $line->{total_tax_included})->format,
129
            );
129
            );
130
            push(@$abaskets, $arrbasket);
130
            push(@$abaskets, $arrbasket);
131
        }
131
        }
Lines 211-253 sub printbaskets { Link Here
211
    for my $bkey (@keys) {
211
    for my $bkey (@keys) {
212
        push(@$arrbasket, $bkey);
212
        push(@$arrbasket, $bkey);
213
    }
213
    }
214
    my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
214
    my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
215
    # calculate each basket total
215
    # calculate each basket total
216
    push(@$abaskets, $arrbasket);
216
    push(@$abaskets, $arrbasket);
217
    for my $basket (@$hbaskets) {
217
    for my $basket (@$hbaskets) {
218
        my @gst;
218
        my @gst;
219
        $arrbasket = undef;
219
        $arrbasket = undef;
220
        my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
220
        my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
221
        my $ords = $orders->{$basket->{basketno}};
221
        my $ords = $orders->{$basket->{basketno}};
222
        my $ordlength = @$ords;
222
        my $ordlength = @$ords;
223
        foreach my $ord (@$ords) {
223
        foreach my $ord (@$ords) {
224
            $totalgste += $ord->{totalgste};
224
            $total_tax_excluded += $ord->{total_tax_excluded};
225
            $totalgsti += $ord->{totalgsti};
225
            $total_tax_included += $ord->{total_tax_included};
226
            $totalgstvalue += $ord->{gstvalue};
226
            $totaltax_value += $ord->{tax_value};
227
            $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
227
            $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
228
            $totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
228
            $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
229
            $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
229
            $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
230
            push @gst, $ord->{gstrate};
230
            push @gst, $ord->{tax_rate};
231
        }
231
        }
232
        @gst = uniq map { $_ * 100 } @gst;
232
        @gst = uniq map { $_ * 100 } @gst;
233
        $grandtotalrrpgste += $totalrrpgste;
233
        $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
234
        $grandtotalrrpgsti += $totalrrpgsti;
234
        $grandtotal_rrp_tax_included += $total_rrp_tax_included;
235
        $grandtotalgsti += $totalgsti;
235
        $grandtotal_tax_included += $total_tax_included;
236
        $grandtotalgste += $totalgste;
236
        $grandtotal_tax_excluded += $total_tax_excluded;
237
        $grandtotalgstvalue += $totalgstvalue;
237
        $grandtotaltax_value += $totaltax_value;
238
        $grandtotaldiscount += $totaldiscount;
238
        $grandtotaldiscount += $totaldiscount;
239
        my @gst_string =
239
        my @gst_string =
240
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
240
          map { Koha::Number::Price->new($_)->format . '%' } @gst;
241
        push(@$arrbasket,
241
        push(@$arrbasket,
242
            $basket->{contractname},
242
            $basket->{contractname},
243
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
243
            $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
244
            Koha::Number::Price->new( $totalrrpgste )->format,
244
            Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
245
            Koha::Number::Price->new( $totalrrpgsti )->format,
245
            Koha::Number::Price->new( $total_rrp_tax_included )->format,
246
            "@gst_string",
246
            "@gst_string",
247
            Koha::Number::Price->new( $totalgstvalue )->format,
247
            Koha::Number::Price->new( $totaltax_value )->format,
248
            Koha::Number::Price->new( $totaldiscount )->format,
248
            Koha::Number::Price->new( $totaldiscount )->format,
249
            Koha::Number::Price->new( $totalgste )->format,
249
            Koha::Number::Price->new( $total_tax_excluded )->format,
250
            Koha::Number::Price->new( $totalgsti )->format,
250
            Koha::Number::Price->new( $total_tax_included )->format,
251
        );
251
        );
252
        push(@$abaskets, $arrbasket);
252
        push(@$abaskets, $arrbasket);
253
    }
253
    }
Lines 256-268 sub printbaskets { Link Here
256
    push @$arrbasket,
256
    push @$arrbasket,
257
      '',
257
      '',
258
      'Total',
258
      'Total',
259
      Koha::Number::Price->new( $grandtotalrrpgste )->format,
259
      Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
260
      Koha::Number::Price->new( $grandtotalrrpgsti )->format,
260
      Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
261
      '',
261
      '',
262
      Koha::Number::Price->new( $grandtotalgstvalue )->format,
262
      Koha::Number::Price->new( $grandtotaltax_value )->format,
263
      Koha::Number::Price->new( $grandtotaldiscount )->format,
263
      Koha::Number::Price->new( $grandtotaldiscount )->format,
264
      Koha::Number::Price->new( $grandtotalgste )->format,
264
      Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
265
      Koha::Number::Price->new( $grandtotalgsti )->format;
265
      Koha::Number::Price->new( $grandtotal_tax_included )->format;
266
    push @$abaskets,$arrbasket;
266
    push @$abaskets,$arrbasket;
267
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
267
    # height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
268
268
(-)a/acqui/supplier.pl (-2 / +2 lines)
Lines 82-88 if ( $op eq 'display' ) { Link Here
82
82
83
    $template->param(
83
    $template->param(
84
        active        => $supplier->{'active'},
84
        active        => $supplier->{'active'},
85
        gstrate       => $supplier->{'gstrate'} + 0.0,
85
        tax_rate       => $supplier->{'tax_rate'} + 0.0,
86
        invoiceprice  => $supplier->{'invoiceprice'},
86
        invoiceprice  => $supplier->{'invoiceprice'},
87
        listprice     => $supplier->{'listprice'},
87
        listprice     => $supplier->{'listprice'},
88
        basketcount   => $supplier->{'basketcount'},
88
        basketcount   => $supplier->{'basketcount'},
Lines 108-114 if ( $op eq 'display' ) { Link Here
108
    $template->param(
108
    $template->param(
109
        # set active ON by default for supplier add (id empty for add)
109
        # set active ON by default for supplier add (id empty for add)
110
        active       => $booksellerid ? $supplier->{'active'} : 1,
110
        active       => $booksellerid ? $supplier->{'active'} : 1,
111
        gstrate       => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
111
        tax_rate       => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
112
        gst_values    => \@gst_values,
112
        gst_values    => \@gst_values,
113
        currencies    => \@currencies,
113
        currencies    => \@currencies,
114
        enter         => 1,
114
        enter         => 1,
(-)a/acqui/updatesupplier.pl (-2 / +2 lines)
Lines 39-45 Here is the list : Link Here
39
supplier, id, company, company_postal, physical, company_phone,
39
supplier, id, company, company_postal, physical, company_phone,
40
physical, company_phone, company_fax, website, company_email, notes,
40
physical, company_phone, company_fax, website, company_email, notes,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
41
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
42
discount, gstrate, contact_name, contact_position, contact_phone,
42
discount, tax_rate, contact_name, contact_position, contact_phone,
43
contact_altphone, contact_fax, contact_email, contact_notes,
43
contact_altphone, contact_fax, contact_email, contact_notes,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
44
contact_claimacquisition, contact_claimissues, contact_acqprimary,
45
contact_serialsprimary.
45
contact_serialsprimary.
Lines 90-96 $data{'gstreg'}=$input->param('gst'); Link Here
90
$data{'listincgst'}=$input->param('list_gst');
90
$data{'listincgst'}=$input->param('list_gst');
91
$data{'invoiceincgst'}=$input->param('invoice_gst');
91
$data{'invoiceincgst'}=$input->param('invoice_gst');
92
#have to transform this into fraction so it's easier to use
92
#have to transform this into fraction so it's easier to use
93
$data{'gstrate'} = $input->param('gstrate');
93
$data{'tax_rate'} = $input->param('tax_rate');
94
$data{'discount'} = $input->param('discount');
94
$data{'discount'} = $input->param('discount');
95
$data{deliverytime} = $input->param('deliverytime');
95
$data{deliverytime} = $input->param('deliverytime');
96
$data{'active'}=$input->param('status');
96
$data{'active'}=$input->param('status');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-46 / +46 lines)
Lines 11-22 Link Here
11
//<![CDATA[
11
//<![CDATA[
12
    function updateColumnsVisibility(visible) {
12
    function updateColumnsVisibility(visible) {
13
        if ( visible ) {
13
        if ( visible ) {
14
            $("table .gste, .gsti").show();
14
            $("table .tax_excluded, .tax_included").show();
15
        } else {
15
        } else {
16
            [% IF ( listincgst ) %]
16
            [% IF ( listincgst ) %]
17
                $("table .gste").hide();
17
                $("table .tax_excluded").hide();
18
            [% ELSE %]
18
            [% ELSE %]
19
                $("table .gsti").hide();
19
                $("table .tax_included").hide();
20
            [% END %]
20
            [% END %]
21
        }
21
        }
22
    }
22
    }
Lines 382-394 Link Here
382
                    <tr>
382
                    <tr>
383
                        <th>No.</th>
383
                        <th>No.</th>
384
                        <th>Order</th>
384
                        <th>Order</th>
385
                        <th class="gste">RRP tax exc.</th>
385
                        <th class="tax_excluded">RRP tax exc.</th>
386
                        <th class="gste">ecost tax exc.</th>
386
                        <th class="tax_excluded">ecost tax exc.</th>
387
                        <th class="gsti">RRP tax inc.</th>
387
                        <th class="tax_included">RRP tax inc.</th>
388
                        <th class="gsti">ecost tax inc.</th>
388
                        <th class="tax_included">ecost tax inc.</th>
389
                        <th>Qty.</th>
389
                        <th>Qty.</th>
390
                        <th class="gste">Total tax exc. ([% currency %])</th>
390
                        <th class="tax_excluded">Total tax exc. ([% currency %])</th>
391
                        <th class="gsti">Total tax inc. ([% currency %])</th>
391
                        <th class="tax_included">Total tax inc. ([% currency %])</th>
392
                        <th>GST %</th>
392
                        <th>GST %</th>
393
                        <th>GST</th>
393
                        <th>GST</th>
394
                        <th>Fund</th>
394
                        <th>Fund</th>
Lines 404-419 Link Here
404
                [% FOREACH foot_loo IN book_foot_loop %]
404
                [% FOREACH foot_loo IN book_foot_loop %]
405
                    <tr>
405
                    <tr>
406
                        <th></th>
406
                        <th></th>
407
                        <th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
407
                        <th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
408
                        <th class="gste">&nbsp;</th>
408
                        <th class="tax_excluded">&nbsp;</th>
409
                        <th class="gste">&nbsp;</th>
409
                        <th class="tax_excluded">&nbsp;</th>
410
                        <th class="gsti">&nbsp;</th>
410
                        <th class="tax_included">&nbsp;</th>
411
                        <th class="gsti">&nbsp;</th>
411
                        <th class="tax_included">&nbsp;</th>
412
                        <th>[% foot_loo.quantity %]</th>
412
                        <th>[% foot_loo.quantity %]</th>
413
                        <th class="gste">[% foot_loo.totalgste | $Price%]</th>
413
                        <th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
414
                        <th class="gsti">[% foot_loo.totalgsti | $Price %]</th>
414
                        <th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
415
                        <th>&nbsp;</th>
415
                        <th>&nbsp;</th>
416
                        <th>[% foot_loo.gstvalue | $Price %]</th>
416
                        <th>[% foot_loo.tax_value | $Price %]</th>
417
                        <th>&nbsp;</th>
417
                        <th>&nbsp;</th>
418
                        [% IF ( active ) %]
418
                        [% IF ( active ) %]
419
                            [% UNLESS ( closedate ) %]
419
                            [% UNLESS ( closedate ) %]
Lines 426-440 Link Here
426
                <tr>
426
                <tr>
427
                    <th></th>
427
                    <th></th>
428
                    <th>Total ([% currency %])</th>
428
                    <th>Total ([% currency %])</th>
429
                    <th class="gste">&nbsp;</th>
429
                    <th class="tax_excluded">&nbsp;</th>
430
                    <th class="gste">&nbsp;</th>
430
                    <th class="tax_excluded">&nbsp;</th>
431
                    <th class="gsti">&nbsp;</th>
431
                    <th class="tax_included">&nbsp;</th>
432
                    <th class="gsti">&nbsp;</th>
432
                    <th class="tax_included">&nbsp;</th>
433
                    <th>[% total_quantity %]</th>
433
                    <th>[% total_quantity %]</th>
434
                    <th class="gste">[% total_gste | $Price %]</th>
434
                    <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
435
                    <th class="gsti">[% total_gsti | $Price %]</th>
435
                    <th class="tax_included">[% total_tax_included | $Price %]</th>
436
                    <th>&nbsp;</th>
436
                    <th>&nbsp;</th>
437
                    <th>[% total_gstvalue | $Price %]</th>
437
                    <th>[% total_tax_value | $Price %]</th>
438
                    <th>&nbsp;</th>
438
                    <th>&nbsp;</th>
439
                    [% IF ( active ) %]
439
                    [% IF ( active ) %]
440
                        [% UNLESS ( closedate ) %]
440
                        [% UNLESS ( closedate ) %]
Lines 499-513 Link Here
499
                        </td>
499
                        </td>
500
                        [% 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 ... %]
500
                        [% 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 ... %]
501
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
501
                        [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
502
                        <td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
502
                        <td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
503
                        <td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
503
                        <td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
504
                        <td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
504
                        <td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
505
                        <td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
505
                        <td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
506
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
506
                        <td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
507
                        <td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
507
                        <td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
508
                        <td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
508
                        <td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
509
                        <td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
509
                        <td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
510
                        <td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
510
                        <td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
511
                        <td>[% books_loo.budget_name %]</td>
511
                        <td>[% books_loo.budget_name %]</td>
512
                        [% IF ( active ) %]
512
                        [% IF ( active ) %]
513
                            [% UNLESS ( closedate ) %]
513
                            [% UNLESS ( closedate ) %]
Lines 560-572 Link Here
560
                <tr>
560
                <tr>
561
                  <th>No.</th>
561
                  <th>No.</th>
562
                  <th>Order</th>
562
                  <th>Order</th>
563
                  <th class="gste">RRP tax exc.</th>
563
                  <th class="tax_excluded">RRP tax exc.</th>
564
                  <th class="gste">ecost tax exc.</th>
564
                  <th class="tax_excluded">ecost tax exc.</th>
565
                  <th class="gsti">RRP tax inc.</th>
565
                  <th class="tax_included">RRP tax inc.</th>
566
                  <th class="gsti">ecost tax inc.</th>
566
                  <th class="tax_included">ecost tax inc.</th>
567
                  <th>Qty.</th>
567
                  <th>Qty.</th>
568
                  <th class="gste">Total tax exc. ([% currency %])</th>
568
                  <th class="tax_excluded">Total tax exc. ([% currency %])</th>
569
                  <th class="gsti">Total tax inc. ([% currency %])</th>
569
                  <th class="tax_included">Total tax inc. ([% currency %])</th>
570
                  <th>GST %</th>
570
                  <th>GST %</th>
571
                  <th>GST</th>
571
                  <th>GST</th>
572
                  <th>Fund</th>
572
                  <th>Fund</th>
Lines 611-625 Link Here
611
                        </p>
611
                        </p>
612
                      [% END %]
612
                      [% END %]
613
                    </td>
613
                    </td>
614
                    <td class="number gste">[% order.rrpgste | $Price %]</td>
614
                    <td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
615
                    <td class="number gste">[% order.ecostgste | $Price %]</td>
615
                    <td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
616
                    <td class="number gsti">[% order.rrpgsti | $Price %]</td>
616
                    <td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
617
                    <td class="number gsti">[% order.ecostgsti | $Price %]</td>
617
                    <td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
618
                    <td class="number">[% order.quantity %]</td>
618
                    <td class="number">[% order.quantity %]</td>
619
                    <td class="number gste">[% order.totalgste | $Price %]</td>
619
                    <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
620
                    <td class="number gsti">[% order.totalgsti | $Price %]</td>
620
                    <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
621
                    <td class="number">[% order.gstrate * 100 | $Price %]</td>
621
                    <td class="number">[% order.tax_rate * 100 | $Price %]</td>
622
                    <td class="number">[% order.gstvalue | $Price %]</td>
622
                    <td class="number">[% order.tax_value | $Price %]</td>
623
                    <td>[% order.budget_name %]
623
                    <td>[% order.budget_name %]
624
                  </tr>
624
                  </tr>
625
                [% END %]
625
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-27 / +27 lines)
Lines 12-23 Link Here
12
//<![CDATA[
12
//<![CDATA[
13
    function updateColumnsVisibility(visible) {
13
    function updateColumnsVisibility(visible) {
14
        if ( visible ) {
14
        if ( visible ) {
15
            $("table .gste, .gsti").show();
15
            $("table .tax_excluded, .tax_included").show();
16
        } else {
16
        } else {
17
            [% IF ( invoiceincgst ) %]
17
            [% IF ( invoiceincgst ) %]
18
                $("table .gste").hide();
18
                $("table .tax_excluded").hide();
19
            [% ELSE %]
19
            [% ELSE %]
20
                $("table .gsti").hide();
20
                $("table .tax_included").hide();
21
            [% END %]
21
            [% END %]
22
        }
22
        }
23
    }
23
    }
Lines 133-143 Link Here
133
              <tr>
133
              <tr>
134
                <th>Summary</th>
134
                <th>Summary</th>
135
                <th>Library</th>
135
                <th>Library</th>
136
                <th class="gste">Actual cost tax exc.</th>
136
                <th class="tax_excluded">Actual cost tax exc.</th>
137
                <th class="gsti">Actual cost tax inc.</th>
137
                <th class="tax_included">Actual cost tax inc.</th>
138
                <th>Qty.</th>
138
                <th>Qty.</th>
139
                <th class="gste">Total tax exc. ([% currency %])</th>
139
                <th class="tax_excluded">Total tax exc. ([% currency %])</th>
140
                <th class="gsti">Total tax inc. ([% currency %])</th>
140
                <th class="tax_included">Total tax inc. ([% currency %])</th>
141
                <th>GST %</th>
141
                <th>GST %</th>
142
                <th>GST</th>
142
                <th>GST</th>
143
                <th>Fund</th>
143
                <th>Fund</th>
Lines 165-177 Link Here
165
                    [% END %]
165
                    [% END %]
166
                  </td>
166
                  </td>
167
                  <td><p>[% order.branchcode %]</p></td>
167
                  <td><p>[% order.branchcode %]</p></td>
168
                  <td class="number gste">[% order.unitpricegste | $Price %]</td>
168
                  <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
169
                  <td class="number gsti">[% order.unitpricegsti | $Price %]</td>
169
                  <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
170
                  <td class="number">[% order.quantity %]</td>
170
                  <td class="number">[% order.quantity %]</td>
171
                  <td class="number gste">[% order.totalgste | $Price %]</td>
171
                  <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
172
                  <td class="number gsti">[% order.totalgsti | $Price %]</td>
172
                  <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
173
                  <td class="number">[% order.gstrate * 100 | $Price %]</td>
173
                  <td class="number">[% order.tax_rate * 100 | $Price %]</td>
174
                  <td class="number">[% order.gstvalue | $Price %]</td>
174
                  <td class="number">[% order.tax_value | $Price %]</td>
175
                  <td>[% order.budget_name %]</td>
175
                  <td>[% order.budget_name %]</td>
176
                </tr>
176
                </tr>
177
              [% END %]
177
              [% END %]
Lines 179-213 Link Here
179
            <tfoot>
179
            <tfoot>
180
              [% FOR tf IN foot_loop %]
180
              [% FOR tf IN foot_loop %]
181
                <tr>
181
                <tr>
182
                    <th colspan='2'>Total (GST [% tf.gstrate * 100 | $Price %] %)</th>
182
                    <th colspan='3'>Total (GST [% tf.tax_rate * 100 | $Price %] %)</th>
183
                    <th class="gste"/><th class="gsti"/>
183
                    <th class="tax_excluded"/><th class="tax_included"/>
184
                    <th>[% tf.quantity %]</th>
184
                    <th>[% tf.quantity %]</th>
185
                    <th class="gste">[% tf.totalgste | $Price %]</th>
185
                    <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
186
                    <th class="gsti">[% tf.totalgsti | $Price %]</th>
186
                    <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
187
                    <th>&nbsp;</th>
187
                    <th>&nbsp;</th>
188
                    <th>[% tf.gstvalue | $Price %]</th>
188
                    <th>[% tf.tax_value | $Price %]</th>
189
                    <th>&nbsp;</th>
189
                    <th>&nbsp;</th>
190
                </tr>
190
                </tr>
191
              [% END %]
191
              [% END %]
192
              <tr>
192
              <tr>
193
                <th colspan='2'>Total ([% currency %])</th>
193
                <th colspan='2'>Total ([% currency %])</th>
194
                <th class="gste"/><th class="gsti"/>
194
                <th class="tax_excluded"/><th class="tax_included"/>
195
                <th>[% total_quantity %]</th>
195
                <th>[% total_quantity %]</th>
196
                <th class="gste">[% total_gste | $Price %]</th>
196
                <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
197
                <th class="gsti">[% total_gsti | $Price %]</th>
197
                <th class="tax_included">[% total_tax_included | $Price %]</th>
198
                <th>&nbsp;</th>
198
                <th>&nbsp;</th>
199
                <th>[% total_gstvalue | $Price %]</th>
199
                <th>[% total_tax_value | $Price %]</th>
200
                <th>&nbsp;</th>
200
                <th>&nbsp;</th>
201
              </tr>
201
              </tr>
202
              <tr>
202
              <tr>
203
                <th colspan="2">Total + Shipment cost ([% currency %])</th>
203
                <th colspan="2">Total + Shipment cost ([% currency %])</th>
204
                <th class="gste"></th>
204
                <th class="tax_excluded"></th>
205
                <th class="gsti"></th>
205
                <th class="tax_included"></th>
206
                <th>[% total_quantity %]</th>
206
                <th>[% total_quantity %]</th>
207
                <th class="gste">[% total_gste_shipment | $Price %]</th>
207
                <th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th>
208
                <th class="gsti">[% total_gsti_shipment | $Price %]</th>
208
                <th class="tax_included">[% total_tax_included_shipment | $Price %]</th>
209
                <th>&nbsp;</th>
209
                <th>&nbsp;</th>
210
                <th>[% total_gstvalue | $Price %]</th>
210
                <th>[% total_tax_value | $Price %]</th>
211
                <th>&nbsp;</th>
211
                <th>&nbsp;</th>
212
              </tr>
212
              </tr>
213
            </tfoot>
213
            </tfoot>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-5 / +5 lines)
Lines 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 43-49 for my $currency_format ( qw( US FR ) ) { Link Here
43
            invoiceid        => $invoiceid_0_0,
43
            invoiceid        => $invoiceid_0_0,
44
            rrp              => 82.00,
44
            rrp              => 82.00,
45
            ecost            => 73.80,
45
            ecost            => 73.80,
46
            gstrate          => 0.0500,
46
            tax_rate         => 0.0500,
47
            discount         => 10.0000,
47
            discount         => 10.0000,
48
            datereceived     => $today
48
            datereceived     => $today
49
        };
49
        };
Lines 58-115 for my $currency_format ( qw( US FR ) ) { Link Here
58
        # Note that this configuration is correct \o/
58
        # Note that this configuration is correct \o/
59
        compare(
59
        compare(
60
            {
60
            {
61
                got      => $order_0_0->{rrpgsti},
61
                got      => $order_0_0->{rrp_tax_included},
62
                expected => 86.10,
62
                expected => 86.10,
63
                conf     => '0 0',
63
                conf     => '0 0',
64
                field    => 'rrpgsti'
64
                field    => 'rrp_tax_included'
65
            }
65
            }
66
        );
66
        );
67
        compare(
67
        compare(
68
            {
68
            {
69
                got      => $order_0_0->{rrpgste},
69
                got      => $order_0_0->{rrp_tax_excluded},
70
                expected => 82.00,
70
                expected => 82.00,
71
                conf     => '0 0',
71
                conf     => '0 0',
72
                field    => 'rrpgste'
72
                field    => 'rrp_tax_excluded'
73
            }
73
            }
74
        );
74
        );
75
        compare(
75
        compare(
76
            {
76
            {
77
                got      => $order_0_0->{ecostgsti},
77
                got      => $order_0_0->{ecost_tax_included},
78
                expected => 77.49,
78
                expected => 77.49,
79
                conf     => '0 0',
79
                conf     => '0 0',
80
                field    => 'ecostgsti'
80
                field    => 'ecost_tax_included'
81
            }
81
            }
82
        );
82
        );
83
        compare(
83
        compare(
84
            {
84
            {
85
                got      => $order_0_0->{ecostgste},
85
                got      => $order_0_0->{ecost_tax_excluded},
86
                expected => 73.80,
86
                expected => 73.80,
87
                conf     => '0 0',
87
                conf     => '0 0',
88
                field    => 'ecostgste'
88
                field    => 'ecost_tax_excluded'
89
            }
89
            }
90
        );
90
        );
91
        compare(
91
        compare(
92
            {
92
            {
93
                got      => $order_0_0->{gstvalue},
93
                got      => $order_0_0->{tax_value},
94
                expected => 7.38,
94
                expected => 7.38,
95
                conf     => '0 0',
95
                conf     => '0 0',
96
                field    => 'gstvalue'
96
                field    => 'tax_value'
97
            }
97
            }
98
        );
98
        );
99
        compare(
99
        compare(
100
            {
100
            {
101
                got      => $order_0_0->{totalgsti},
101
                got      => $order_0_0->{total_tax_included},
102
                expected => 154.98,
102
                expected => 154.98,
103
                conf     => '0 0',
103
                conf     => '0 0',
104
                field    => 'totalgsti'
104
                field    => 'total_tax_included'
105
            }
105
            }
106
        );
106
        );
107
        compare(
107
        compare(
108
            {
108
            {
109
                got      => $order_0_0->{totalgste},
109
                got      => $order_0_0->{total_tax_excluded},
110
                expected => 147.60,
110
                expected => 147.60,
111
                conf     => '0 0',
111
                conf     => '0 0',
112
                field    => 'totalgste'
112
                field    => 'total_tax_excluded'
113
            }
113
            }
114
        );
114
        );
115
115
Lines 124-165 for my $currency_format ( qw( US FR ) ) { Link Here
124
        # Note that this configuration is correct \o/
124
        # Note that this configuration is correct \o/
125
        compare(
125
        compare(
126
            {
126
            {
127
                got      => $order_0_0->{unitpricegsti},
127
                got      => $order_0_0->{unitprice_tax_included},
128
                expected => 77.49,
128
                expected => 77.49,
129
                conf     => '0 0',
129
                conf     => '0 0',
130
                field    => 'unitpricegsti'
130
                field    => 'unitprice_tax_included'
131
            }
131
            }
132
        );
132
        );
133
        compare(
133
        compare(
134
            {
134
            {
135
                got      => $order_0_0->{unitpricegste},
135
                got      => $order_0_0->{unitprice_tax_excluded},
136
                expected => 73.80,
136
                expected => 73.80,
137
                conf     => '0 0',
137
                conf     => '0 0',
138
                field    => 'unitpricegste'
138
                field    => 'unitprice_tax_excluded'
139
            }
139
            }
140
        );
140
        );
141
        compare(
141
        compare(
142
            {
142
            {
143
                got      => $order_0_0->{gstvalue},
143
                got      => $order_0_0->{tax_value},
144
                expected => 7.38,
144
                expected => 7.38,
145
                conf     => '0 0',
145
                conf     => '0 0',
146
                field    => 'gstvalue'
146
                field    => 'tax_value'
147
            }
147
            }
148
        );
148
        );
149
        compare(
149
        compare(
150
            {
150
            {
151
                got      => $order_0_0->{totalgsti},
151
                got      => $order_0_0->{total_tax_included},
152
                expected => 154.98,
152
                expected => 154.98,
153
                conf     => '0 0',
153
                conf     => '0 0',
154
                field    => 'totalgsti'
154
                field    => 'total_tax_included'
155
            }
155
            }
156
        );
156
        );
157
        compare(
157
        compare(
158
            {
158
            {
159
                got      => $order_0_0->{totalgste},
159
                got      => $order_0_0->{total_tax_excluded},
160
                expected => 147.60,
160
                expected => 147.60,
161
                conf     => '0 0',
161
                conf     => '0 0',
162
                field    => 'totalgste'
162
                field    => 'total_tax_excluded'
163
            }
163
            }
164
        );
164
        );
165
    };
165
    };
Lines 184-190 for my $currency_format ( qw( US FR ) ) { Link Here
184
            invoiceid        => $invoiceid_1_1,
184
            invoiceid        => $invoiceid_1_1,
185
            rrp              => 82.00,
185
            rrp              => 82.00,
186
            ecost            => 73.80,
186
            ecost            => 73.80,
187
            gstrate          => 0.0500,
187
            tax_rate         => 0.0500,
188
            discount         => 10.0000,
188
            discount         => 10.0000,
189
            datereceived     => $today
189
            datereceived     => $today
190
        };
190
        };
Lines 198-258 for my $currency_format ( qw( US FR ) ) { Link Here
198
        );
198
        );
199
199
200
        # Note that this configuration is *not* correct
200
        # Note that this configuration is *not* correct
201
        # gstvalue should be 7.03 instead of 7.02
201
        # tax_value should be 7.03 instead of 7.02
202
        compare(
202
        compare(
203
            {
203
            {
204
                got      => $order_1_1->{rrpgsti},
204
                got      => $order_1_1->{rrp_tax_included},
205
                expected => 82.00,
205
                expected => 82.00,
206
                conf     => '1 1',
206
                conf     => '1 1',
207
                field    => 'rrpgsti'
207
                field    => 'rrp_tax_included'
208
            }
208
            }
209
        );
209
        );
210
        compare(
210
        compare(
211
            {
211
            {
212
                got      => $order_1_1->{rrpgste},
212
                got      => $order_1_1->{rrp_tax_excluded},
213
                expected => 78.10,
213
                expected => 78.10,
214
                conf     => '1 1',
214
                conf     => '1 1',
215
                field    => 'rrpgste'
215
                field    => 'rrp_tax_excluded'
216
            }
216
            }
217
        );
217
        );
218
        compare(
218
        compare(
219
            {
219
            {
220
                got      => $order_1_1->{ecostgsti},
220
                got      => $order_1_1->{ecost_tax_included},
221
                expected => 73.80,
221
                expected => 73.80,
222
                conf     => '1 1',
222
                conf     => '1 1',
223
                field    => 'ecostgsti'
223
                field    => 'ecost_tax_included'
224
            }
224
            }
225
        );
225
        );
226
        compare(
226
        compare(
227
            {
227
            {
228
                got      => $order_1_1->{ecostgste},
228
                got      => $order_1_1->{ecost_tax_excluded},
229
                expected => 70.29,
229
                expected => 70.29,
230
                conf     => '1 1',
230
                conf     => '1 1',
231
                field    => 'ecostgste'
231
                field    => 'ecost_tax_excluded'
232
            }
232
            }
233
        );
233
        );
234
        compare(
234
        compare(
235
            {
235
            {
236
                got      => $order_1_1->{gstvalue},
236
                got      => $order_1_1->{tax_value},
237
                expected => 7.02,
237
                expected => 7.02,
238
                conf     => '1 1',
238
                conf     => '1 1',
239
                field    => 'gstvalue'
239
                field    => 'tax_value'
240
            }
240
            }
241
        );
241
        );
242
        compare(
242
        compare(
243
            {
243
            {
244
                got      => $order_1_1->{totalgsti},
244
                got      => $order_1_1->{total_tax_included},
245
                expected => 147.60,
245
                expected => 147.60,
246
                conf     => '1 1',
246
                conf     => '1 1',
247
                field    => 'totalgsti'
247
                field    => 'total_tax_included'
248
            }
248
            }
249
        );
249
        );
250
        compare(
250
        compare(
251
            {
251
            {
252
                got      => $order_1_1->{totalgste},
252
                got      => $order_1_1->{total_tax_excluded},
253
                expected => 140.58,
253
                expected => 140.58,
254
                conf     => '1 1',
254
                conf     => '1 1',
255
                field    => 'totalgste'
255
                field    => 'total_tax_excluded'
256
            }
256
            }
257
        );
257
        );
258
258
Lines 264-308 for my $currency_format ( qw( US FR ) ) { Link Here
264
            }
264
            }
265
        );
265
        );
266
        # Note that this configuration is *not* correct!
266
        # Note that this configuration is *not* correct!
267
        # gstvalue should be 7.03
267
        # tax_value should be 7.03
268
        compare(
268
        compare(
269
            {
269
            {
270
                got      => $order_1_1->{unitpricegsti},
270
                got      => $order_1_1->{unitprice_tax_included},
271
                expected => 73.80,
271
                expected => 73.80,
272
                conf     => '1 1',
272
                conf     => '1 1',
273
                field    => 'unitpricegsti'
273
                field    => 'unitprice_tax_included'
274
            }
274
            }
275
        );
275
        );
276
        compare(
276
        compare(
277
            {
277
            {
278
                got      => $order_1_1->{unitpricegste},
278
                got      => $order_1_1->{unitprice_tax_excluded},
279
                expected => 70.29,
279
                expected => 70.29,
280
                conf     => '1 1',
280
                conf     => '1 1',
281
                field    => 'unitpricegste'
281
                field    => 'unitprice_tax_excluded'
282
            }
282
            }
283
        );
283
        );
284
        compare(
284
        compare(
285
            {
285
            {
286
                got      => $order_1_1->{gstvalue},
286
                got      => $order_1_1->{tax_value},
287
                expected => 7.02,
287
                expected => 7.02,
288
                conf     => '1 1',
288
                conf     => '1 1',
289
                field    => 'gstvalue'
289
                field    => 'tax_value'
290
            }
290
            }
291
        );
291
        );
292
        compare(
292
        compare(
293
            {
293
            {
294
                got      => $order_1_1->{totalgsti},
294
                got      => $order_1_1->{total_tax_included},
295
                expected => 147.60,
295
                expected => 147.60,
296
                conf     => '1 1',
296
                conf     => '1 1',
297
                field    => 'totalgsti'
297
                field    => 'total_tax_included'
298
            }
298
            }
299
        );
299
        );
300
        compare(
300
        compare(
301
            {
301
            {
302
                got      => $order_1_1->{totalgste},
302
                got      => $order_1_1->{total_tax_excluded},
303
                expected => 140.58,
303
                expected => 140.58,
304
                conf     => '1 1',
304
                conf     => '1 1',
305
                field    => 'totalgste'
305
                field    => 'total_tax_excluded'
306
            }
306
            }
307
        );
307
        );
308
    };
308
    };
Lines 327-333 for my $currency_format ( qw( US FR ) ) { Link Here
327
            invoiceid        => $invoiceid_1_1,
327
            invoiceid        => $invoiceid_1_1,
328
            rrp              => 82.01,
328
            rrp              => 82.01,
329
            ecost            => 73.80,
329
            ecost            => 73.80,
330
            gstrate          => 0.0500,
330
            tax_rate         => 0.0500,
331
            discount         => 10.0000,
331
            discount         => 10.0000,
332
            datereceived     => $today
332
            datereceived     => $today
333
        };
333
        };
Lines 341-404 for my $currency_format ( qw( US FR ) ) { Link Here
341
        );
341
        );
342
342
343
        # Note that this configuration is *not* correct!
343
        # Note that this configuration is *not* correct!
344
        # rrp gsti should be 82 (what we inserted!)
344
        # rrp_tax_included should be 82 (what we inserted!)
345
        # => Actually we need to fix the inserted value (here we have 82.01 in DB)
345
        # tax_value should be 7.03 instead of 7.02
346
        # gstvalue should be 7.03 instead of 7.02
347
346
348
        compare(
347
        compare(
349
            {
348
            {
350
                got      => $order_1_0->{rrpgsti},
349
                got      => $order_1_0->{rrp_tax_included},
351
                expected => 82.01,
350
                expected => 82.01,
352
                conf     => '1 0',
351
                conf     => '1 0',
353
                field    => 'rrpgsti'
352
                field    => 'rrp_tax_included'
354
            }
353
            }
355
        );
354
        );
356
        compare(
355
        compare(
357
            {
356
            {
358
                got      => $order_1_0->{rrpgste},
357
                got      => $order_1_0->{rrp_tax_excluded},
359
                expected => 78.10,
358
                expected => 78.10,
360
                conf     => '1 0',
359
                conf     => '1 0',
361
                field    => 'rrpgste'
360
                field    => 'rrp_tax_excluded'
362
            }
361
            }
363
        );
362
        );
364
        compare(
363
        compare(
365
            {
364
            {
366
                got      => $order_1_0->{ecostgsti},
365
                got      => $order_1_0->{ecost_tax_included},
367
                expected => 73.80,
366
                expected => 73.80,
368
                conf     => '1 0',
367
                conf     => '1 0',
369
                field    => 'ecostgsti'
368
                field    => 'ecost_tax_included'
370
            }
369
            }
371
        );
370
        );
372
        compare(
371
        compare(
373
            {
372
            {
374
                got      => $order_1_0->{ecostgste},
373
                got      => $order_1_0->{ecost_tax_excluded},
375
                expected => 70.29,
374
                expected => 70.29,
376
                conf     => '1 0',
375
                conf     => '1 0',
377
                field    => 'ecostgste'
376
                field    => 'ecost_tax_excluded'
378
            }
377
            }
379
        );
378
        );
380
        compare(
379
        compare(
381
            {
380
            {
382
                got      => $order_1_0->{gstvalue},
381
                got      => $order_1_0->{tax_value},
383
                expected => 7.02,
382
                expected => 7.02,
384
                conf     => '1 0',
383
                conf     => '1 0',
385
                field    => 'gstvalue'
384
                field    => 'tax_value'
386
            }
385
            }
387
        );
386
        );
388
        compare(
387
        compare(
389
            {
388
            {
390
                got      => $order_1_0->{totalgsti},
389
                got      => $order_1_0->{total_tax_included},
391
                expected => 147.60,
390
                expected => 147.60,
392
                conf     => '1 0',
391
                conf     => '1 0',
393
                field    => 'totalgsti'
392
                field    => 'total_tax_included'
394
            }
393
            }
395
        );
394
        );
396
        compare(
395
        compare(
397
            {
396
            {
398
                got      => $order_1_0->{totalgste},
397
                got      => $order_1_0->{total_tax_excluded},
399
                expected => 140.58,
398
                expected => 140.58,
400
                conf     => '1 0',
399
                conf     => '1 0',
401
                field    => 'totalgste'
400
                field    => 'total_tax_excluded'
402
            }
401
            }
403
        );
402
        );
404
403
Lines 413-454 for my $currency_format ( qw( US FR ) ) { Link Here
413
        # gstvalue should be 7.03
412
        # gstvalue should be 7.03
414
        compare(
413
        compare(
415
            {
414
            {
416
                got      => $order_1_0->{unitpricegsti},
415
                got      => $order_1_0->{unitprice_tax_included},
417
                expected => 73.80,
416
                expected => 73.80,
418
                conf     => '1 0',
417
                conf     => '1 0',
419
                field    => 'unitpricegsti'
418
                field    => 'unitprice_tax_included'
420
            }
419
            }
421
        );
420
        );
422
        compare(
421
        compare(
423
            {
422
            {
424
                got      => $order_1_0->{unitpricegste},
423
                got      => $order_1_0->{unitprice_tax_excluded},
425
                expected => 70.29,
424
                expected => 70.29,
426
                conf     => '1 0',
425
                conf     => '1 0',
427
                field    => 'unitpricegste'
426
                field    => 'unitprice_tax_excluded'
428
            }
427
            }
429
        );
428
        );
430
        compare(
429
        compare(
431
            {
430
            {
432
                got      => $order_1_0->{gstvalue},
431
                got      => $order_1_0->{tax_value},
433
                expected => 7.02,
432
                expected => 7.02,
434
                conf     => '1 0',
433
                conf     => '1 0',
435
                field    => 'gstvalue'
434
                field    => 'tax_value'
436
            }
435
            }
437
        );
436
        );
438
        compare(
437
        compare(
439
            {
438
            {
440
                got      => $order_1_0->{totalgsti},
439
                got      => $order_1_0->{total_tax_included},
441
                expected => 147.60,
440
                expected => 147.60,
442
                conf     => '1 0',
441
                conf     => '1 0',
443
                field    => 'totalgsti'
442
                field    => 'total_tax_included'
444
            }
443
            }
445
        );
444
        );
446
        compare(
445
        compare(
447
            {
446
            {
448
                got      => $order_1_0->{totalgste},
447
                got      => $order_1_0->{total_tax_excluded},
449
                expected => 140.58,
448
                expected => 140.58,
450
                conf     => '1 0',
449
                conf     => '1 0',
451
                field    => 'totalgste'
450
                field    => 'total_tax_excluded'
452
            }
451
            }
453
        );
452
        );
454
    };
453
    };
Lines 473-479 for my $currency_format ( qw( US FR ) ) { Link Here
473
            invoiceid        => $invoiceid_1_1,
472
            invoiceid        => $invoiceid_1_1,
474
            rrp              => 82.00,
473
            rrp              => 82.00,
475
            ecost            => 73.80,
474
            ecost            => 73.80,
476
            gstrate          => 0.0500,
475
            tax_rate         => 0.0500,
477
            discount         => 10.0000,
476
            discount         => 10.0000,
478
            datereceived     => $today
477
            datereceived     => $today
479
        };
478
        };
Lines 489-546 for my $currency_format ( qw( US FR ) ) { Link Here
489
        # Note that this configuration is correct \o/
488
        # Note that this configuration is correct \o/
490
        compare(
489
        compare(
491
            {
490
            {
492
                got      => $order_0_1->{rrpgsti},
491
                got      => $order_0_1->{rrp_tax_included},
493
                expected => 86.10,
492
                expected => 86.10,
494
                conf     => '1 0',
493
                conf     => '1 0',
495
                field    => 'rrpgsti'
494
                field    => 'rrp_tax_included'
496
            }
495
            }
497
        );
496
        );
498
        compare(
497
        compare(
499
            {
498
            {
500
                got      => $order_0_1->{rrpgste},
499
                got      => $order_0_1->{rrp_tax_excluded},
501
                expected => 82.00,
500
                expected => 82.00,
502
                conf     => '1 0',
501
                conf     => '1 0',
503
                field    => 'rrpgste'
502
                field    => 'rrp_tax_excluded'
504
            }
503
            }
505
        );
504
        );
506
        compare(
505
        compare(
507
            {
506
            {
508
                got      => $order_0_1->{ecostgsti},
507
                got      => $order_0_1->{ecost_tax_included},
509
                expected => 77.49,
508
                expected => 77.49,
510
                conf     => '1 0',
509
                conf     => '1 0',
511
                field    => 'ecostgsti'
510
                field    => 'ecost_tax_included'
512
            }
511
            }
513
        );
512
        );
514
        compare(
513
        compare(
515
            {
514
            {
516
                got      => $order_0_1->{ecostgste},
515
                got      => $order_0_1->{ecost_tax_excluded},
517
                expected => 73.80,
516
                expected => 73.80,
518
                conf     => '1 0',
517
                conf     => '1 0',
519
                field    => 'ecostgste'
518
                field    => 'ecost_tax_excluded'
520
            }
519
            }
521
        );
520
        );
522
        compare(
521
        compare(
523
            {
522
            {
524
                got      => $order_0_1->{gstvalue},
523
                got      => $order_0_1->{tax_value},
525
                expected => 7.38,
524
                expected => 7.38,
526
                conf     => '1 0',
525
                conf     => '1 0',
527
                field    => 'gstvalue'
526
                field    => 'tax_value'
528
            }
527
            }
529
        );
528
        );
530
        compare(
529
        compare(
531
            {
530
            {
532
                got      => $order_0_1->{totalgsti},
531
                got      => $order_0_1->{total_tax_included},
533
                expected => 154.98,
532
                expected => 154.98,
534
                conf     => '1 0',
533
                conf     => '1 0',
535
                field    => 'totalgsti'
534
                field    => 'total_tax_included'
536
            }
535
            }
537
        );
536
        );
538
        compare(
537
        compare(
539
            {
538
            {
540
                got      => $order_0_1->{totalgste},
539
                got      => $order_0_1->{total_tax_excluded},
541
                expected => 147.60,
540
                expected => 147.60,
542
                conf     => '1 0',
541
                conf     => '1 0',
543
                field    => 'totalgste'
542
                field    => 'total_tax_excluded'
544
            }
543
            }
545
        );
544
        );
546
545
Lines 554-595 for my $currency_format ( qw( US FR ) ) { Link Here
554
        # Note that this configuration is correct
553
        # Note that this configuration is correct
555
        compare(
554
        compare(
556
            {
555
            {
557
                got      => $order_0_1->{unitpricegsti},
556
                got      => $order_0_1->{unitprice_tax_included},
558
                expected => 77.49,
557
                expected => 77.49,
559
                conf     => '0 1',
558
                conf     => '0 1',
560
                field    => 'unitpricegsti'
559
                field    => 'unitprice_tax_included'
561
            }
560
            }
562
        );
561
        );
563
        compare(
562
        compare(
564
            {
563
            {
565
                got      => $order_0_1->{unitpricegste},
564
                got      => $order_0_1->{unitprice_tax_excluded},
566
                expected => 73.80,
565
                expected => 73.80,
567
                conf     => '0 1',
566
                conf     => '0 1',
568
                field    => 'unitpricegste'
567
                field    => 'unitprice_tax_excluded'
569
            }
568
            }
570
        );
569
        );
571
        compare(
570
        compare(
572
            {
571
            {
573
                got      => $order_0_1->{gstvalue},
572
                got      => $order_0_1->{tax_value},
574
                expected => 7.38,
573
                expected => 7.38,
575
                conf     => '0 1',
574
                conf     => '0 1',
576
                field    => 'gstvalue'
575
                field    => 'tax_value'
577
            }
576
            }
578
        );
577
        );
579
        compare(
578
        compare(
580
            {
579
            {
581
                got      => $order_0_1->{totalgsti},
580
                got      => $order_0_1->{total_tax_included},
582
                expected => 154.98,
581
                expected => 154.98,
583
                conf     => '0 1',
582
                conf     => '0 1',
584
                field    => 'totalgsti'
583
                field    => 'total_tax_included'
585
            }
584
            }
586
        );
585
        );
587
        compare(
586
        compare(
588
            {
587
            {
589
                got      => $order_0_1->{totalgste},
588
                got      => $order_0_1->{total_tax_excluded},
590
                expected => 147.60,
589
                expected => 147.60,
591
                conf     => '0 1',
590
                conf     => '0 1',
592
                field    => 'totalgste'
591
                field    => 'total_tax_excluded'
593
            }
592
            }
594
        );
593
        );
595
    };
594
    };
(-)a/t/db_dependent/Acquisition.t (-36 / +48 lines)
Lines 181-187 my @order_content = ( Link Here
181
            ecost     => 38.15,
181
            ecost     => 38.15,
182
            rrp       => 40.15,
182
            rrp       => 40.15,
183
            discount  => 5.1111,
183
            discount  => 5.1111,
184
            gstrate   => 0.0515
184
            tax_rate   => 0.0515
185
        }
185
        }
186
    },
186
    },
187
    {
187
    {
Lines 209-215 my @order_content = ( Link Here
209
            ecost     => 38.1,
209
            ecost     => 38.1,
210
            rrp       => 11.0,
210
            rrp       => 11.0,
211
            discount  => 5.1,
211
            discount  => 5.1,
212
            gstrate   => 0.1
212
            tax_rate   => 0.1
213
        }
213
        }
214
    },
214
    },
215
    {
215
    {
Lines 229-235 my @order_content = ( Link Here
229
            rrp            => 11.00,
229
            rrp            => 11.00,
230
            discount       => 0,
230
            discount       => 0,
231
            uncertainprice => 0,
231
            uncertainprice => 0,
232
            gstrate        => 0
232
            tax_rate        => 0
233
        }
233
        }
234
    },
234
    },
235
    {
235
    {
Lines 249-255 my @order_content = ( Link Here
249
            rrp            => 10,
249
            rrp            => 10,
250
            discount       => 0,
250
            discount       => 0,
251
            uncertainprice => 0,
251
            uncertainprice => 0,
252
            gstrate        => 0
252
            tax_rate        => 0
253
        }
253
        }
254
    }
254
    }
255
);
255
);
Lines 339-354 my @expectedfields = qw( Link Here
339
  invoiceid
339
  invoiceid
340
  freight
340
  freight
341
  unitprice
341
  unitprice
342
  unitprice_tax_included
343
  unitprice_tax_excluded
342
  quantityreceived
344
  quantityreceived
343
  datecancellationprinted
345
  datecancellationprinted
344
  purchaseordernumber
346
  purchaseordernumber
345
  basketno
347
  basketno
346
  timestamp
348
  timestamp
347
  rrp
349
  rrp
350
  rrp_tax_included
351
  rrp_tax_excluded
348
  ecost
352
  ecost
353
  ecost_tax_included
354
  ecost_tax_excluded
349
  unitpricesupplier
355
  unitpricesupplier
350
  unitpricelib
356
  unitpricelib
351
  gstrate
357
  tax_rate
358
  tax_value
352
  discount
359
  discount
353
  budget_id
360
  budget_id
354
  budgetgroup_id
361
  budgetgroup_id
Lines 413-418 my @base_expectedfields = qw( Link Here
413
  notes
420
  notes
414
  ordernumber
421
  ordernumber
415
  ecost
422
  ecost
423
  ecost_tax_included
424
  ecost_tax_excluded
416
  uncertainprice
425
  uncertainprice
417
  marc
426
  marc
418
  url
427
  url
Lines 443-448 my @base_expectedfields = qw( Link Here
443
  budget_parent_id
452
  budget_parent_id
444
  publishercode
453
  publishercode
445
  unitprice
454
  unitprice
455
  unitprice_tax_included
456
  unitprice_tax_excluded
446
  collectionvolume
457
  collectionvolume
447
  budget_amount
458
  budget_amount
448
  budget_owner_id
459
  budget_owner_id
Lines 460-466 my @base_expectedfields = qw( Link Here
460
  orderstatus
471
  orderstatus
461
  agerestriction
472
  agerestriction
462
  budget_branchcode
473
  budget_branchcode
463
  gstrate
474
  tax_rate
475
  tax_value
464
  listprice
476
  listprice
465
  budget_code
477
  budget_code
466
  budgetdate
478
  budgetdate
Lines 484-489 my @base_expectedfields = qw( Link Here
484
  sort2_authcat
496
  sort2_authcat
485
  budget_expend
497
  budget_expend
486
  rrp
498
  rrp
499
  rrp_tax_included
500
  rrp_tax_excluded
487
  cn_sort
501
  cn_sort
488
  lccn
502
  lccn
489
  sort1
503
  sort1
Lines 571-583 ok( Link Here
571
  firstname
585
  firstname
572
  biblioitemnumber
586
  biblioitemnumber
573
  ecost
587
  ecost
588
  ecost_tax_included
589
  ecost_tax_excluded
574
  uncertainprice
590
  uncertainprice
575
  creationdate
591
  creationdate
576
  datereceived
592
  datereceived
577
  orderstatus
593
  orderstatus
578
  isbn
594
  isbn
579
  copyrightdate
595
  copyrightdate
580
  gstrate
596
  tax_rate
597
  tax_value
581
  serial
598
  serial
582
  listprice
599
  listprice
583
  budgetdate
600
  budgetdate
Lines 604-610 ok( Link Here
604
  unititle
621
  unititle
605
  sort2_authcat
622
  sort2_authcat
606
  rrp
623
  rrp
624
  rrp_tax_included
625
  rrp_tax_excluded
607
  unitprice
626
  unitprice
627
  unitprice_tax_included
628
  unitprice_tax_excluded
608
  sort1
629
  sort1
609
  ordernumber
630
  ordernumber
610
  datecreated
631
  datecreated
Lines 630-644 my $invoiceid = AddInvoice( Link Here
630
    unknown       => "unknown"
651
    unknown       => "unknown"
631
);
652
);
632
653
654
my $invoice = GetInvoice( $invoiceid );
655
633
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
656
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
634
    {
657
    {
635
        biblionumber      => $biblionumber4,
658
        biblionumber      => $biblionumber4,
636
        ordernumber       => $ordernumbers[4],
659
        order             => GetOrder( $ordernumbers[4] ),
637
        quantityreceived  => 1,
660
        quantityreceived  => 1,
638
        cost              => 10,
661
        invoice           => $invoice,
639
        ecost             => 10,
640
        invoiceid         => $invoiceid,
641
        rrp               => 10,
642
        budget_id          => $order_content[4]->{str}->{budget_id},
662
        budget_id          => $order_content[4]->{str}->{budget_id},
643
    }
663
    }
644
);
664
);
Lines 796-815 is( Link Here
796
    "AddClaim : Check claimed_date"
816
    "AddClaim : Check claimed_date"
797
);
817
);
798
818
819
my $order2 = GetOrder( $ordernumbers[1] );
820
$order2->{order_internalnote} = "my notes";
799
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
821
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
800
    {
822
    {
801
        biblionumber     => $biblionumber2,
823
        biblionumber     => $biblionumber2,
802
        ordernumber      => $ordernumbers[1],
824
        order            => $order2,
803
        quantityreceived => 2,
825
        quantityreceived => 2,
804
        cost             => 12,
826
        invoice          => $invoice,
805
        ecost            => 12,
806
        invoiceid        => $invoiceid,
807
        rrp              => 42,
808
        order_internalnote => "my notes",
809
        order_vendornote   => "my vendor notes",
810
    }
827
    }
811
);
828
)
812
my $order2 = GetOrder( $ordernumbers[1] );
829
;
830
$order2 = GetOrder( $ordernumbers[1] );
813
is( $order2->{'quantityreceived'},
831
is( $order2->{'quantityreceived'},
814
    0, 'Splitting up order did not receive any on original order' );
832
    0, 'Splitting up order did not receive any on original order' );
815
is( $order2->{'quantity'}, 40, '40 items on original order' );
833
is( $order2->{'quantity'}, 40, '40 items on original order' );
Lines 817-824 is( $order2->{'budget_id'}, $budgetid, Link Here
817
    'Budget on original order is unchanged' );
835
    'Budget on original order is unchanged' );
818
is( $order2->{order_internalnote}, "my notes",
836
is( $order2->{order_internalnote}, "my notes",
819
    'ModReceiveOrder and GetOrder deal with internal notes' );
837
    'ModReceiveOrder and GetOrder deal with internal notes' );
820
is( $order2->{order_vendornote}, "my vendor notes",
821
    'ModReceiveOrder and GetOrder deal with vendor notes' );
822
838
823
$neworder = GetOrder($new_ordernumber);
839
$neworder = GetOrder($new_ordernumber);
824
is( $neworder->{'quantity'}, 2, '2 items on new order' );
840
is( $neworder->{'quantity'}, 2, '2 items on new order' );
Lines 841-861 my $budgetid2 = C4::Budgets::AddBudget( Link Here
841
    }
857
    }
842
);
858
);
843
859
860
my $order3 = GetOrder( $ordernumbers[2] );
861
$order3->{order_internalnote} = "my other notes";
844
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
862
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
845
    {
863
    {
846
        biblionumber     => $biblionumber2,
864
        biblionumber     => $biblionumber2,
847
        ordernumber      => $ordernumbers[2],
865
        order            => $order3,
848
        quantityreceived => 2,
866
        quantityreceived => 2,
849
        cost             => 12,
867
        invoice          => $invoice,
850
        ecost            => 12,
851
        invoiceid        => $invoiceid,
852
        rrp              => 42,
853
        budget_id        => $budgetid2,
868
        budget_id        => $budgetid2,
854
        order_internalnote => "my other notes",
855
    }
869
    }
856
);
870
);
857
871
858
my $order3 = GetOrder( $ordernumbers[2] );
872
$order3 = GetOrder( $ordernumbers[2] );
859
is( $order3->{'quantityreceived'},
873
is( $order3->{'quantityreceived'},
860
    0, 'Splitting up order did not receive any on original order' );
874
    0, 'Splitting up order did not receive any on original order' );
861
is( $order3->{'quantity'}, 2, '2 items on original order' );
875
is( $order3->{'quantity'}, 2, '2 items on original order' );
Lines 870-886 is( $neworder->{'quantityreceived'}, Link Here
870
    2, 'Splitting up order received items on new order' );
884
    2, 'Splitting up order received items on new order' );
871
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
885
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
872
886
887
$order3 = GetOrder( $ordernumbers[2] );
888
$order3->{order_internalnote} = "my third notes";
873
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
889
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
874
    {
890
    {
875
        biblionumber     => $biblionumber2,
891
        biblionumber     => $biblionumber2,
876
        ordernumber      => $ordernumbers[2],
892
        order            => $order3,
877
        quantityreceived => 2,
893
        quantityreceived => 2,
878
        cost             => 12,
894
        invoice          => $invoice,
879
        ecost            => 12,
880
        invoiceid        => $invoiceid,
881
        rrp              => 42,
882
        budget_id        => $budgetid2,
895
        budget_id        => $budgetid2,
883
        order_internalnote => "my third notes",
884
    }
896
    }
885
);
897
);
886
898
(-)a/t/db_dependent/Acquisition/CancelReceipt.t (-6 / +3 lines)
Lines 60-68 my $ordernumber = $order->{ordernumber}; Link Here
60
ModReceiveOrder(
60
ModReceiveOrder(
61
    {
61
    {
62
        biblionumber     => $biblionumber,
62
        biblionumber     => $biblionumber,
63
        ordernumber      => $ordernumber,
63
        order            => $order,
64
        quantityreceived => 2,
64
        quantityreceived => 2,
65
        datereceived     => dt_from_string
66
    }
65
    }
67
);
66
);
68
67
Lines 70-77 $order->add_item( $itemnumber ); Link Here
70
69
71
CancelReceipt($ordernumber);
70
CancelReceipt($ordernumber);
72
71
73
$order = GetOrder( $ordernumber );
72
is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
74
is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
75
73
76
my $itemnumber1 = AddItem({}, $biblionumber);
74
my $itemnumber1 = AddItem({}, $biblionumber);
77
my $itemnumber2 = AddItem({}, $biblionumber);
75
my $itemnumber2 = AddItem({}, $biblionumber);
Lines 103-111 is( Link Here
103
my ( undef, $new_ordernumber ) = ModReceiveOrder(
101
my ( undef, $new_ordernumber ) = ModReceiveOrder(
104
    {
102
    {
105
        biblionumber     => $biblionumber,
103
        biblionumber     => $biblionumber,
106
        ordernumber      => $ordernumber,
104
        order            => $order,
107
        quantityreceived => 1,
105
        quantityreceived => 1,
108
        datereceived     => dt_from_string,
109
        received_items   => [ $itemnumber1 ],
106
        received_items   => [ $itemnumber1 ],
110
    }
107
    }
111
);
108
);
(-)a/t/db_dependent/Acquisition/Invoices.t (-16 / +11 lines)
Lines 91-116 my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $bookse Link Here
91
                            shipmentdate => '2012-12-24',
91
                            shipmentdate => '2012-12-24',
92
                           );
92
                           );
93
93
94
my $invoice1 = GetInvoice( $invoiceid1 );
95
my $invoice2 = GetInvoice( $invoiceid2 );
96
94
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
97
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
95
    {
98
    {
96
        biblionumber     => $biblionumber1,
99
        biblionumber     => $biblionumber1,
97
        ordernumber      => $ordernumber1,
100
        order            => $order1,
98
        quantityreceived => 2,
101
        quantityreceived => 2,
99
        cost             => 12,
102
        invoice          => $invoice1,
100
        ecost            => 12,
101
        invoiceid        => $invoiceid1,
102
        rrp              => 42
103
    }
103
    }
104
);
104
);
105
105
106
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
106
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
107
    {
107
    {
108
        biblionumber     => $biblionumber2,
108
        biblionumber     => $biblionumber2,
109
        ordernumber      => $ordernumber2,
109
        order            => $order2,
110
        quantityreceived => 1,
110
        quantityreceived => 1,
111
        cost             => 5,
111
        invoice          => $invoice2,
112
        ecost            => 5,
113
        invoiceid        => $invoiceid2,
114
        rrp              => 42
112
        rrp              => 42
115
    }
113
    }
116
);
114
);
Lines 118-134 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( Link Here
118
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
116
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
119
    {
117
    {
120
        biblionumber     => $biblionumber3,
118
        biblionumber     => $biblionumber3,
121
        ordernumber      => $ordernumber3,
119
        order            => $order3,
122
        quantityreceived => 1,
120
        quantityreceived => 1,
123
        cost             => 12,
121
        invoice          => $invoice2,
124
        ecost            => 12,
125
        invoiceid        => $invoiceid2,
126
        rrp              => 42
127
    }
122
    }
128
);
123
);
129
124
130
my $invoice1 = GetInvoiceDetails($invoiceid1);
125
$invoice1 = GetInvoiceDetails($invoiceid1);
131
my $invoice2 = GetInvoiceDetails($invoiceid2);
126
$invoice2 = GetInvoiceDetails($invoiceid2);
132
127
133
is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order');
128
is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order');
134
is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders');
129
is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders');
(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (-6 / +6 lines)
Lines 68-74 my $order = Koha::Acquisition::Order->new({ Link Here
68
    basketno => $basketno,
68
    basketno => $basketno,
69
    rrp => $cost,
69
    rrp => $cost,
70
    ecost => $cost,
70
    ecost => $cost,
71
    gstrate => 0.0500,
71
    tax_rate => 0.0500,
72
    orderstatus => 'new',
72
    orderstatus => 'new',
73
    subscriptionid => $subscription->{subscriptionid},
73
    subscriptionid => $subscription->{subscriptionid},
74
    budget_id => $budget_id,
74
    budget_id => $budget_id,
Lines 85-100 ok( $order->{ecost} == $cost, "test cost for the last order not received"); Link Here
85
$dbh->do(q{DELETE FROM aqinvoices});
85
$dbh->do(q{DELETE FROM aqinvoices});
86
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
86
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
87
87
88
my $invoice = GetInvoice( $invoiceid );
89
$invoice->{datereceived} = '02-01-2013';
90
88
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
91
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
89
    {
92
    {
90
        biblionumber     => $biblionumber,
93
        biblionumber     => $biblionumber,
91
        ordernumber      => $ordernumber,
94
        order            => $order,
92
        quantityreceived => 1,
95
        quantityreceived => 1,
93
        cost             => $cost,
94
        ecost            => $cost,
95
        rrp              => $cost,
96
        budget_id        => $budget_id,
96
        budget_id        => $budget_id,
97
        invoiceid        => $invoiceid,
97
        invoice          => $invoice,
98
    }
98
    }
99
);
99
);
100
100
(-)a/t/db_dependent/Acquisition/TransferOrder.t (-2 / +3 lines)
Lines 95-105 $orders = SearchOrders({ ordernumber => $ordernumber }); Link Here
95
is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' );
95
is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' );
96
is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' );
96
is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' );
97
97
98
my $neworder = GetOrder( $newordernumber );
99
98
ModReceiveOrder({
100
ModReceiveOrder({
99
    biblionumber => $biblionumber,
101
    biblionumber => $biblionumber,
100
    ordernumber => $newordernumber,
102
    order       => $neworder,
101
    quantityreceived => 2, 
103
    quantityreceived => 2, 
102
    datereceived => dt_from_string(),
103
});
104
});
104
CancelReceipt( $newordernumber );
105
CancelReceipt( $newordernumber );
105
$order = GetOrder( $newordernumber );
106
$order = GetOrder( $newordernumber );
(-)a/t/db_dependent/Bookseller.t (-9 / +9 lines)
Lines 62-68 my $sample_supplier1 = { Link Here
62
    gstreg        => 1,
62
    gstreg        => 1,
63
    listincgst    => 1,
63
    listincgst    => 1,
64
    invoiceincgst => 1,
64
    invoiceincgst => 1,
65
    gstrate       => '1.0000',
65
    tax_rate       => '1.0000',
66
    discount      => '1.0000',
66
    discount      => '1.0000',
67
    notes         => 'notes1',
67
    notes         => 'notes1',
68
    deliverytime  => undef
68
    deliverytime  => undef
Lines 82-88 my $sample_supplier2 = { Link Here
82
    gstreg        => 1,
82
    gstreg        => 1,
83
    listincgst    => 1,
83
    listincgst    => 1,
84
    invoiceincgst => 1,
84
    invoiceincgst => 1,
85
    gstrate       => '2.0000',
85
    tax_rate       => '2.0000',
86
    discount      => '2.0000',
86
    discount      => '2.0000',
87
    notes         => 'notes2',
87
    notes         => 'notes2',
88
    deliverytime  => 2
88
    deliverytime  => 2
Lines 223-229 $sample_supplier2 = { Link Here
223
    gstreg        => 1,
223
    gstreg        => 1,
224
    listincgst    => 1,
224
    listincgst    => 1,
225
    invoiceincgst => 1,
225
    invoiceincgst => 1,
226
    gstrate       => '2.0000 ',
226
    tax_rate       => '2.0000 ',
227
    discount      => '2.0000',
227
    discount      => '2.0000',
228
    notes         => 'notes2 modified',
228
    notes         => 'notes2 modified',
229
    deliverytime  => 2,
229
    deliverytime  => 2,
Lines 263-269 my $sample_supplier3 = { Link Here
263
    gstreg        => 1,
263
    gstreg        => 1,
264
    listincgst    => 1,
264
    listincgst    => 1,
265
    invoiceincgst => 1,
265
    invoiceincgst => 1,
266
    gstrate       => '3.0000',
266
    tax_rate       => '3.0000',
267
    discount      => '3.0000',
267
    discount      => '3.0000',
268
    notes         => 'notes3',
268
    notes         => 'notes3',
269
    deliverytime  => 3
269
    deliverytime  => 3
Lines 283-289 my $sample_supplier4 = { Link Here
283
    gstreg        => 1,
283
    gstreg        => 1,
284
    listincgst    => 1,
284
    listincgst    => 1,
285
    invoiceincgst => 1,
285
    invoiceincgst => 1,
286
    gstrate       => '3.0000',
286
    tax_rate       => '3.0000',
287
    discount      => '3.0000',
287
    discount      => '3.0000',
288
    notes         => 'notes3',
288
    notes         => 'notes3',
289
};
289
};
Lines 360-366 my $order1 = Koha::Acquisition::Order->new( Link Here
360
        entrydate        => '01-01-2013',
360
        entrydate        => '01-01-2013',
361
        currency         => 'EUR',
361
        currency         => 'EUR',
362
        notes            => "This is a note1",
362
        notes            => "This is a note1",
363
        gstrate          => 0.0500,
363
        tax_rate          => 0.0500,
364
        orderstatus      => 1,
364
        orderstatus      => 1,
365
        subscriptionid   => $id_subscription1,
365
        subscriptionid   => $id_subscription1,
366
        quantityreceived => 2,
366
        quantityreceived => 2,
Lines 380-386 my $order2 = Koha::Acquisition::Order->new( Link Here
380
        entrydate      => '01-01-2013',
380
        entrydate      => '01-01-2013',
381
        currency       => 'EUR',
381
        currency       => 'EUR',
382
        notes          => "This is a note2",
382
        notes          => "This is a note2",
383
        gstrate        => 0.0500,
383
        tax_rate        => 0.0500,
384
        orderstatus    => 1,
384
        orderstatus    => 1,
385
        subscriptionid => $id_subscription2,
385
        subscriptionid => $id_subscription2,
386
        rrp            => 10,
386
        rrp            => 10,
Lines 398-404 my $order3 = Koha::Acquisition::Order->new( Link Here
398
        entrydate      => '02-02-2013',
398
        entrydate      => '02-02-2013',
399
        currency       => 'EUR',
399
        currency       => 'EUR',
400
        notes          => "This is a note3",
400
        notes          => "This is a note3",
401
        gstrate        => 0.0500,
401
        tax_rate        => 0.0500,
402
        orderstatus    => 2,
402
        orderstatus    => 2,
403
        subscriptionid => $id_subscription3,
403
        subscriptionid => $id_subscription3,
404
        rrp            => 11,
404
        rrp            => 11,
Lines 416-422 my $order4 = Koha::Acquisition::Order->new( Link Here
416
        entrydate        => '02-02-2013',
416
        entrydate        => '02-02-2013',
417
        currency         => 'EUR',
417
        currency         => 'EUR',
418
        notes            => "This is a note3",
418
        notes            => "This is a note3",
419
        gstrate          => 0.0500,
419
        tax_rate          => 0.0500,
420
        orderstatus      => 2,
420
        orderstatus      => 2,
421
        subscriptionid   => $id_subscription3,
421
        subscriptionid   => $id_subscription3,
422
        rrp              => 11,
422
        rrp              => 11,
(-)a/t/db_dependent/Budgets.t (-7 / +5 lines)
Lines 316-321 my @order_infos = ( Link Here
316
316
317
my %budgets;
317
my %budgets;
318
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
318
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
319
my $invoice = GetInvoice( $invoiceid );
319
my $item_price = 10;
320
my $item_price = 10;
320
my $item_quantity = 2;
321
my $item_quantity = 2;
321
my $number_of_orders_to_move = 0;
322
my $number_of_orders_to_move = 0;
Lines 336-342 for my $infos (@order_infos) { Link Here
336
                rrp                => $item_price,
337
                rrp                => $item_price,
337
                discount           => 0,
338
                discount           => 0,
338
                uncertainprice     => 0,
339
                uncertainprice     => 0,
339
                gstrate            => 0,
340
                tax_rate            => 0,
340
            }
341
            }
341
        )->insert;
342
        )->insert;
342
        my $ordernumber = $order->{ordernumber};
343
        my $ordernumber = $order->{ordernumber};
Lines 359-377 for my $infos (@order_infos) { Link Here
359
                rrp                => $item_price,
360
                rrp                => $item_price,
360
                discount           => 0,
361
                discount           => 0,
361
                uncertainprice     => 0,
362
                uncertainprice     => 0,
362
                gstrate            => 0,
363
                tax_rate            => 0,
363
            }
364
            }
364
        )->insert;
365
        )->insert;
365
        my $ordernumber = $order->{ordernumber};
366
        my $ordernumber = $order->{ordernumber};
366
        ModReceiveOrder({
367
        ModReceiveOrder({
367
              biblionumber     => $biblionumber,
368
              biblionumber     => $biblionumber,
368
              ordernumber      => $ordernumber,
369
              order            => $order,
369
              budget_id        => $infos->{budget_id},
370
              budget_id        => $infos->{budget_id},
370
              quantityreceived => $item_quantity,
371
              quantityreceived => $item_quantity,
371
              cost             => $item_price,
372
              invoice          => $invoice,
372
              ecost            => $item_price,
373
              invoiceid        => $invoiceid,
374
              rrp              => $item_price,
375
              received_items   => [],
373
              received_items   => [],
376
        } );
374
        } );
377
    }
375
    }
(-)a/t/db_dependent/Serials/Claims.t (-3 / +2 lines)
Lines 48-54 my $sample_supplier1 = { Link Here
48
    gstreg        => 1,
48
    gstreg        => 1,
49
    listincgst    => 1,
49
    listincgst    => 1,
50
    invoiceincgst => 1,
50
    invoiceincgst => 1,
51
    gstrate       => '1.0000',
51
    tax_rate       => '1.0000',
52
    discount      => '1.0000',
52
    discount      => '1.0000',
53
    notes         => 'notes1',
53
    notes         => 'notes1',
54
    deliverytime  => undef
54
    deliverytime  => undef
Lines 68-74 my $sample_supplier2 = { Link Here
68
    gstreg        => 1,
68
    gstreg        => 1,
69
    listincgst    => 1,
69
    listincgst    => 1,
70
    invoiceincgst => 1,
70
    invoiceincgst => 1,
71
    gstrate       => '2.0000',
71
    tax_rate       => '2.0000',
72
    discount      => '2.0000',
72
    discount      => '2.0000',
73
    notes         => 'notes2',
73
    notes         => 'notes2',
74
    deliverytime  => 2
74
    deliverytime  => 2
75
- 

Return to bug 13321