From f1c376e335efe50f74e582eedbcedce7da520568 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Nov 2014 16:10:52 +0100 Subject: [PATCH] Bug 13321: Rename variables This patch renames the variable according to the new DB column names * gste => tax_excluded * gsti => tax_included * gstrate => tax_rate * gstvalue => tax_value This patch also modify the ModReceiveOrder subroutine: * Edit vendor note on receiving is not possible, so the code should not permit that. * Update ModReceiveOrder to pass a hashref And that's all! git grep on gste, gsti, gstrate and gstvalue should not return any code that can be executed. Signed-off-by: Laurence Rault Signed-off-by: Francois Charbonnier Signed-off-by: Sonia Bouis --- C4/Acquisition.pm | 218 ++++++++++----------- C4/Bookseller.pm | 8 +- acqui/addorderiso2709.pl | 6 +- acqui/basket.pl | 35 ++-- acqui/basketgroup.pl | 19 +- acqui/finishreceive.pl | 41 ++-- acqui/invoice.pl | 42 ++-- acqui/neworderempty.pl | 4 +- acqui/orderreceive.pl | 12 +- acqui/parcel.pl | 37 ++-- acqui/pdfformat/layout2pages.pm | 8 +- acqui/pdfformat/layout2pagesde.pm | 8 +- acqui/pdfformat/layout3pages.pm | 60 +++--- acqui/pdfformat/layout3pagesfr.pm | 60 +++--- acqui/supplier.pl | 4 +- acqui/updatesupplier.pl | 4 +- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 92 ++++----- .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 54 ++--- .../prog/en/modules/acqui/neworderempty.tt | 10 +- .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 8 +- .../prog/en/modules/acqui/supplier.tt | 12 +- .../prog/en/modules/help/acqui/basket.tt | 2 +- .../prog/en/modules/serials/subscription-detail.tt | 8 +- serials/subscription-detail.pl | 30 +-- t/Prices.t | 209 ++++++++++---------- t/db_dependent/Acquisition.t | 84 ++++---- t/db_dependent/Acquisition/CancelReceipt.t | 9 +- t/db_dependent/Acquisition/Invoices.t | 27 ++- t/db_dependent/Acquisition/OrderFromSubscription.t | 12 +- t/db_dependent/Acquisition/TransferOrder.t | 5 +- t/db_dependent/Bookseller.t | 18 +- t/db_dependent/Budgets.t | 12 +- t/db_dependent/Serials/Claims.t | 4 +- 34 files changed, 581 insertions(+), 583 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 6a2ed3e..a6640d5 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1334,58 +1334,42 @@ sub ModItemOrder { =head3 ModReceiveOrder - &ModReceiveOrder({ - biblionumber => $biblionumber, - ordernumber => $ordernumber, - quantityreceived => $quantityreceived, - user => $user, - cost => $cost, - ecost => $ecost, - invoiceid => $invoiceid, - rrp => $rrp, - budget_id => $budget_id, - datereceived => $datereceived, - received_itemnumbers => \@received_itemnumbers, - order_internalnote => $order_internalnote, - order_vendornote => $order_vendornote, - }); + my ( $date_received, $new_ordernumber ) = ModReceiveOrder( + { + biblionumber => $biblionumber, + order => $order, + quantityreceived => $quantityreceived, + user => $user, + invoice => $invoice, + budget_id => $budget_id, + received_itemnumbers => \@received_itemnumbers, + order_internalnote => $order_internalnote, + } + ); Updates an order, to reflect the fact that it was received, at least -in part. All arguments not mentioned below update the fields with the -same name in the aqorders table of the Koha database. +in part. If a partial order is received, splits the order into two. -Updates the order with bibilionumber C<$biblionumber> and ordernumber -C<$ordernumber>. +Updates the order with biblionumber C<$biblionumber> and ordernumber +C<$order->{ordernumber}>. =cut sub ModReceiveOrder { - my ( $params ) = @_; - my $biblionumber = $params->{biblionumber}; - my $ordernumber = $params->{ordernumber}; - my $quantrec = $params->{quantityreceived}; - my $user = $params->{user}; - my $cost = $params->{cost}; - my $ecost = $params->{ecost}; - my $invoiceid = $params->{invoiceid}; - my $rrp = $params->{rrp}; - my $budget_id = $params->{budget_id}; - my $datereceived = $params->{datereceived}; + my ($params) = @_; + my $biblionumber = $params->{biblionumber}; + my $order = { %{ $params->{order} } }; # Copy the order, we don't want to modify it + my $invoice = $params->{invoice}; + my $quantrec = $params->{quantityreceived}; + my $user = $params->{user}; + my $budget_id = $params->{budget_id}; my $received_items = $params->{received_items}; - my $order_internalnote = $params->{order_internalnote}; - my $order_vendornote = $params->{order_vendornote}; my $dbh = C4::Context->dbh; - $datereceived = output_pref( - { - dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ), - dateformat => 'iso', - dateonly => 1, - } - ); + my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string; my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber ); if ($suggestionid) { ModSuggestion( {suggestionid=>$suggestionid, @@ -1394,16 +1378,8 @@ sub ModReceiveOrder { ); } - my $result_set = $dbh->selectall_arrayref( -q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketno) WHERE biblionumber=? AND aqorders.ordernumber=?}, - { Slice => {} }, $biblionumber, $ordernumber - ); - - # we assume we have a unique order - my $order = $result_set->[0]; - - my $new_ordernumber = $ordernumber; - if ( $order->{is_standing} || $order->{quantity} > $quantrec ) { + my $new_ordernumber = $order->{ordernumber}; + if ( $order->{quantity} > $quantrec ) { # Split order line in two parts: the first is the original order line # without received items (the quantity is decreased), # the second part is a new order line with quantity=quantityrec @@ -1412,28 +1388,23 @@ q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketn UPDATE aqorders SET quantity = ?, orderstatus = 'partial'|; - $query .= q|, order_internalnote = ?| if defined $order_internalnote; - $query .= q|, order_vendornote = ?| if defined $order_vendornote; + $query .= q|, order_internalnote = ?| if defined $order->{order_internalnote}; $query .= q| WHERE ordernumber = ?|; my $sth = $dbh->prepare($query); $sth->execute( - ( $order->{is_standing} ? 1 : ( $order->{quantity} - $quantrec ) ), - ( defined $order_internalnote ? $order_internalnote : () ), - ( defined $order_vendornote ? $order_vendornote : () ), - $ordernumber + $order->{quantity} - $quantrec, + ( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ), + $order->{ordernumber} ); - delete $order->{'ordernumber'}; - $order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} ); - $order->{'quantity'} = $quantrec; - $order->{'quantityreceived'} = $quantrec; - $order->{'datereceived'} = $datereceived; - $order->{'invoiceid'} = $invoiceid; - $order->{'unitprice'} = $cost; - $order->{'rrp'} = $rrp; - $order->{ecost} = $ecost; - $order->{'orderstatus'} = 'complete'; + delete $order->{ordernumber}; + $order->{budget_id} = ( $budget_id || $order->{budget_id} ); + $order->{quantity} = $quantrec; + $order->{quantityreceived} = $quantrec; + $order->{datereceived} = $datereceived; + $order->{invoiceid} = $invoice->{invoiceid}; + $order->{orderstatus} = 'complete'; $new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber}; if ($received_items) { @@ -1443,29 +1414,54 @@ q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketn } } else { my $query = q| - update aqorders - set quantityreceived=?,datereceived=?,invoiceid=?, - unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete'|; - $query .= q|, order_internalnote = ?| if defined $order_internalnote; - $query .= q|, order_vendornote = ?| if defined $order_vendornote; + UPDATE aqorders + SET quantityreceived = ?, + datereceived = ?, + invoiceid = ?, + budget_id = ?, + orderstatus = 'complete' + |; + + $query .= q| + , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ? + | if defined $order->{unitprice}; + + $query .= q| + , rrp = ?, rrp_tax_included = ?, rrp_tax_excluded = ? + | if defined $order->{rrp}; + + $query .= q| + , ecost = ?, ecost_tax_included = ?, ecost_tax_excluded = ? + | if defined $order->{ecost}; + + $query .= q| + , order_internalnote = ? + | if defined $order->{order_internalnote}; + $query .= q| where biblionumber=? and ordernumber=?|; + my $sth = $dbh->prepare( $query ); - $sth->execute( - $quantrec, - $datereceived, - $invoiceid, - $cost, - $rrp, - $ecost, - ( $budget_id ? $budget_id : $order->{budget_id} ), - ( defined $order_internalnote ? $order_internalnote : () ), - ( defined $order_vendornote ? $order_vendornote : () ), - $biblionumber, - $ordernumber - ); + my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, $budget_id ); + + if ( defined $order->{unitprice} ) { + push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded}; + } + if ( defined $order->{rrp} ) { + push @params, $order->{rrp}, $order->{rrp_tax_included}, $order->{rrp_tax_excluded}; + } + if ( defined $order->{ecost} ) { + push @params, $order->{ecost}, $order->{ecost_tax_included}, $order->{ecost_tax_excluded}; + } + if ( defined $order->{order_internalnote} ) { + push @params, $order->{order_internalnote}; + } + + push @params, ( $biblionumber, $order->{ordernumber} ); + + $sth->execute( @params ); # All items have been received, sent a notification to users - NotifyOrderUsers( $ordernumber ); + NotifyOrderUsers( $order->{ordernumber} ); } return ($datereceived, $new_ordernumber); @@ -2850,50 +2846,44 @@ sub populate_order_with_prices { $order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round; if ($ordering) { if ( $bookseller->{listincgst} ) { - $order->{rrpgsti} = $order->{rrp}; - $order->{rrpgste} = Koha::Number::Price->new( - $order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round; - $order->{ecostgsti} = $order->{ecost}; - $order->{ecostgste} = Koha::Number::Price->new( - $order->{ecost} / ( 1 + $order->{gstrate} ) )->round; - $order->{gstvalue} = Koha::Number::Price->new( - ( $order->{ecostgsti} - $order->{ecostgste} ) * + $order->{rrp_tax_included} = $order->{rrp}; + $order->{rrp_tax_excluded} = Koha::Number::Price->new( + $order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round; + $order->{ecost_tax_included} = $order->{ecost}; + $order->{ecost_tax_excluded} = Koha::Number::Price->new( + $order->{ecost} / ( 1 + $order->{tax_rate} ) )->round; + $order->{tax_value} = Koha::Number::Price->new( + ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) * $order->{quantity} )->round; - $order->{totalgste} = $order->{ecostgste} * $order->{quantity}; - $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity}; } else { - $order->{rrpgste} = $order->{rrp}; - $order->{rrpgsti} = Koha::Number::Price->new( - $order->{rrp} * ( 1 + $order->{gstrate} ) )->round; - $order->{ecostgste} = $order->{ecost}; - $order->{ecostgsti} = Koha::Number::Price->new( - $order->{ecost} * ( 1 + $order->{gstrate} ) )->round; - $order->{gstvalue} = Koha::Number::Price->new( - ( $order->{ecostgsti} - $order->{ecostgste} ) * + $order->{rrp_tax_excluded} = $order->{rrp}; + $order->{rrp_tax_included} = Koha::Number::Price->new( + $order->{rrp} * ( 1 + $order->{tax_rate} ) )->round; + $order->{ecost_tax_excluded} = $order->{ecost}; + $order->{ecost_tax_included} = Koha::Number::Price->new( + $order->{ecost} * ( 1 + $order->{tax_rate} ) )->round; + $order->{tax_value} = Koha::Number::Price->new( + ( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) * $order->{quantity} )->round; - $order->{totalgste} = $order->{ecostgste} * $order->{quantity}; - $order->{totalgsti} = $order->{ecostgsti} * $order->{quantity}; } } if ($receiving) { if ( $bookseller->{listincgst} ) { - $order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round; - $order->{unitpricegste} = Koha::Number::Price->new( - $order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round; + $order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round; + $order->{unitprice_tax_excluded} = Koha::Number::Price->new( + $order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round; } else { - $order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round; - $order->{unitpricegsti} = Koha::Number::Price->new( - $order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round; + $order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round; + $order->{unitprice_tax_included} = Koha::Number::Price->new( + $order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round; } - $order->{gstvalue} = Koha::Number::Price->new( - ( $order->{unitpricegsti} - $order->{unitpricegste} ) + $order->{tax_value} = Koha::Number::Price->new( + ( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} ) * $order->{quantityreceived} )->round; - $order->{totalgste} = $order->{unitpricegste} * $order->{quantity}; - $order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity}; } return $order; diff --git a/C4/Bookseller.pm b/C4/Bookseller.pm index 44b9389..8a5f43e 100644 --- a/C4/Bookseller.pm +++ b/C4/Bookseller.pm @@ -136,7 +136,7 @@ sub AddBookseller { name, address1, address2, address3, address4, postal, phone, accountnumber,fax, url, active, listprice, invoiceprice, gstreg, - listincgst,invoiceincgst, gstrate, discount, notes, + listincgst,invoiceincgst, tax_rate, discount, notes, deliverytime ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | @@ -151,7 +151,7 @@ sub AddBookseller { $data->{'active'}, $data->{'listprice'}, $data->{'invoiceprice'}, $data->{'gstreg'}, $data->{'listincgst'}, $data->{'invoiceincgst'}, - $data->{'gstrate'}, $data->{'discount'}, + $data->{'tax_rate'}, $data->{'discount'}, $data->{notes}, $data->{deliverytime}, ); @@ -194,7 +194,7 @@ sub ModBookseller { postal=?,phone=?,accountnumber=?,fax=?,url=?, active=?,listprice=?, invoiceprice=?, gstreg=?,listincgst=?,invoiceincgst=?, - discount=?,notes=?,gstrate=?,deliverytime=? + discount=?,notes=?,tax_rate=?,deliverytime=? WHERE id=?'; my $sth = $dbh->prepare($query); my $cnt = $sth->execute( @@ -207,7 +207,7 @@ sub ModBookseller { $data->{'invoiceprice'}, $data->{'gstreg'}, $data->{'listincgst'}, $data->{'invoiceincgst'}, $data->{'discount'}, $data->{'notes'}, - $data->{'gstrate'}, $data->{deliverytime}, + $data->{'tax_rate'}, $data->{deliverytime}, $data->{'id'} ); $contacts ||= $data->{'contacts'}; diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index d2c2e25..e425051 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -205,7 +205,7 @@ if ($op eq ""){ # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; $price = Koha::Number::Price->new($price)->unformat; - $orderinfo{gstrate} = $bookseller->{gstrate}; + $orderinfo{tax_rate} = $bookseller->{tax_rate}; my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100; if ( $bookseller->{listincgst} ) { if ( $c_discount ) { @@ -217,10 +217,10 @@ if ($op eq ""){ } } else { if ( $c_discount ) { - $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} ); + $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} ); $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); } else { - $orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} ); + $orderinfo{rrp} = $price / ( 1 + $orderinfo{tax_rate} ); $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); } } diff --git a/acqui/basket.pl b/acqui/basket.pl index f3bf36a..5d3690d 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -306,27 +306,29 @@ elsif ( $op eq 'ediorder' ) { my @book_foot_loop; my %foot; my $total_quantity = 0; - my $total_gste = 0; - my $total_gsti = 0; - my $total_gstvalue = 0; + my $total_tax_excluded = 0; + my $total_tax_included = 0; + my $total_tax_value = 0; for my $order (@orders) { - $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 }); my $line = get_order_infos( $order, $bookseller); if ( $line->{uncertainprice} ) { $template->param( uncertainprices => 1 ); } + $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format; + $line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format; + push @books_loop, $line; - $foot{$$line{gstrate}}{gstrate} = $$line{gstrate}; - $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue}; - $total_gstvalue += $$line{gstvalue}; - $foot{$$line{gstrate}}{quantity} += $$line{quantity}; + $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate}; + $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value}; + $total_tax_value += $$line{tax_value}; + $foot{$$line{tax_rate}}{quantity} += $$line{quantity}; $total_quantity += $$line{quantity}; - $foot{$$line{gstrate}}{totalgste} += $$line{totalgste}; - $total_gste += $$line{totalgste}; - $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti}; - $total_gsti += $$line{totalgsti}; + $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded}; + $total_tax_excluded += $$line{total_tax_excluded}; + $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included}; + $total_tax_included += $$line{total_tax_included}; } push @book_foot_loop, map {$_} values %foot; @@ -335,7 +337,6 @@ elsif ( $op eq 'ediorder' ) { my @cancelledorders = GetOrders($basketno, { cancelled => 1 }); my @cancelledorders_loop; for my $order (@cancelledorders) { - $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 }); my $line = get_order_infos( $order, $bookseller); push @cancelledorders_loop, $line; } @@ -387,9 +388,9 @@ elsif ( $op eq 'ediorder' ) { book_foot_loop => \@book_foot_loop, cancelledorders_loop => \@cancelledorders_loop, total_quantity => $total_quantity, - total_gste => sprintf( "%.2f", $total_gste ), - total_gsti => sprintf( "%.2f", $total_gsti ), - total_gstvalue => sprintf( "%.2f", $total_gstvalue ), + total_tax_excluded => $total_tax_excluded, + total_tax_included => $total_tax_included, + total_tax_value => $total_tax_value, currency => $active_currency->currency, listincgst => $bookseller->{listincgst}, basketgroups => $basketgroups, @@ -423,7 +424,7 @@ sub get_order_infos { $line{budget_name} = $budget->{budget_name}; if ( $line{uncertainprice} ) { - $line{rrpgste} .= ' (Uncertain)'; + $line{rrp_tax_excluded} .= ' (Uncertain)'; } if ( $line{'title'} ) { my $volume = $order->{'volume'}; diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index ddc2ec2..232547c 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -74,9 +74,14 @@ sub BasketTotal { my $total = 0; my @orders = GetOrders($basketno); for my $order (@orders){ - $total = $total + ( $order->{ecost} * $order->{quantity} ); - if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) { - my $gst = $bookseller->{gstrate} // C4::Context->preference("gist"); + # FIXME The following is wrong + if ( $bookseller->{listincgst} ) { + $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} ); + } else { + $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} ); + } + if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{tax_rate} // C4::Context->preference("gist") )) { + my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist"); $total = $total * ( $gst / 100 +1); } } @@ -167,13 +172,15 @@ sub printbasketgrouppdf{ croak $@; } - $ord = C4::Acquisition::populate_order_with_prices({ order => $ord, booksellerid => $bookseller->{id}, ordering => 1 }); + $ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity}; + $ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity}; + my $bib = GetBiblioData($ord->{biblionumber}); my $itemtypes = GetItemTypes(); #FIXME DELETE ME # 0 1 2 3 4 5 6 7 8 9 - #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate + #isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount tax_rate # Editor Number my $en; @@ -201,7 +208,7 @@ sub printbasketgrouppdf{ -type => 'application/pdf', -attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf' ); - my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed"; + my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed"; print $pdf; } diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 111eadc..0a62887 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -56,7 +56,6 @@ my $booksellerid = $input->param('booksellerid'); my $cnt = 0; my $ecost = $input->param('ecost'); my $rrp = $input->param('rrp'); -my $order_internalnote = $input->param("order_internalnote"); my $bookfund = $input->param("bookfund"); my $order = GetOrder($ordernumber); my $new_ordernumber = $ordernumber; @@ -83,40 +82,40 @@ if ($quantityrec > $origquantityrec ) { } } + $order->{order_internalnote} = $input->param("order_internalnote"); $order->{rrp} = $rrp; $order->{ecost} = $ecost; $order->{unitprice} = $unitprice; + + # FIXME is it still useful? my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); if ( $bookseller->{listincgst} ) { if ( not $bookseller->{invoiceincgst} ) { - $order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} ); - $order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} ); - $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} ); + $order->{rrp} = $order->{rrp} * ( 1 + $order->{tax_rate} ); + $order->{ecost} = $order->{ecost} * ( 1 + $order->{tax_rate} ); + $order->{unitprice} = $order->{unitprice} * ( 1 + $order->{tax_rate} ); } } else { if ( $bookseller->{invoiceincgst} ) { - $order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} ); - $order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} ); - $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} ); + $order->{rrp} = $order->{rrp} / ( 1 + $order->{tax_rate} ); + $order->{ecost} = $order->{ecost} / ( 1 + $order->{tax_rate} ); + $order->{unitprice} = $order->{unitprice} / ( 1 + $order->{tax_rate} ); } } # save the quantity received. if ( $quantityrec > 0 ) { - ($datereceived, $new_ordernumber) = ModReceiveOrder({ - biblionumber => $biblionumber, - ordernumber => $ordernumber, - quantityreceived => $quantityrec, - user => $user, - cost => $order->{unitprice}, - ecost => $order->{ecost}, - invoiceid => $invoiceid, - rrp => $order->{rrp}, - budget_id => $bookfund, - datereceived => $datereceived, - received_items => \@received_items, - order_internalnote => $order_internalnote, - } ); + ( $datereceived, $new_ordernumber ) = ModReceiveOrder( + { + biblionumber => $biblionumber, + order => $order, + quantityreceived => $quantityrec, + user => $user, + invoice => $invoice, + budget_id => $bookfund, + received_items => \@received_items, + } + ); } # now, add items if applicable diff --git a/acqui/invoice.pl b/acqui/invoice.pl index 08e3ee8..dd6ed3b 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -116,28 +116,24 @@ my $orders = $details->{'orders'}; my @foot_loop; my %foot; my $total_quantity = 0; -my $total_gste = 0; -my $total_gsti = 0; -my $total_gstvalue = 0; +my $total_tax_excluded = 0; +my $total_tax_included = 0; +my $total_tax_value = 0; foreach my $order (@$orders) { - $order = C4::Acquisition::populate_order_with_prices( - { - order => $order, - booksellerid => $bookseller->{id}, - receiving => 1, - } - ); my $line = get_infos( $order, $bookseller); - $foot{$$line{gstrate}}{gstrate} = $$line{gstrate}; - $foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue}; - $total_gstvalue += $$line{gstvalue}; - $foot{$$line{gstrate}}{quantity} += $$line{quantity}; + $line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format; + $line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format; + + $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate}; + $foot{$$line{tax_rate}}{tax_value} += $$line{tax_value}; + $total_tax_value += $$line{tax_value}; + $foot{$$line{tax_rate}}{quantity} += $$line{quantity}; $total_quantity += $$line{quantity}; - $foot{$$line{gstrate}}{totalgste} += $$line{totalgste}; - $total_gste += $$line{totalgste}; - $foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti}; - $total_gsti += $$line{totalgsti}; + $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded}; + $total_tax_excluded += $$line{total_tax_excluded}; + $foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included}; + $total_tax_included += $$line{total_tax_included}; $line->{orderline} = $line->{parent_ordernumber}; push @orders_loop, $line; @@ -172,11 +168,11 @@ $template->param( orders_loop => \@orders_loop, foot_loop => \@foot_loop, total_quantity => $total_quantity, - total_gste => sprintf( $format, $total_gste ), - total_gsti => sprintf( $format, $total_gsti ), - total_gstvalue => sprintf( $format, $total_gstvalue ), - total_gste_shipment => sprintf( $format, $total_gste + $details->{shipmentcost}), - total_gsti_shipment => sprintf( $format, $total_gsti + $details->{shipmentcost}), + total_tax_excluded => sprintf( $format, $total_tax_excluded ), + total_tax_included => sprintf( $format, $total_tax_included ), + total_tax_value => sprintf( $format, $total_tax_value ), + total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}), + total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}), invoiceincgst => $bookseller->{invoiceincgst}, currency => Koha::Acquisition::Currencies->get_active, budgets_loop => \@budgets_loop, diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 10f6074..a94db54 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -265,7 +265,7 @@ if ( defined $subscriptionid ) { $budget_id = $lastOrderReceived->{budgetid}; $data->{listprice} = $lastOrderReceived->{listprice}; $data->{uncertainprice} = $lastOrderReceived->{uncertainprice}; - $data->{gstrate} = $lastOrderReceived->{gstrate}; + $data->{tax_rate} = $lastOrderReceived->{tax_rate}; $data->{discount} = $lastOrderReceived->{discount}; $data->{rrp} = $lastOrderReceived->{rrp}; $data->{ecost} = $lastOrderReceived->{ecost}; @@ -350,7 +350,7 @@ $template->param( quantityrec => $quantity, rrp => $data->{'rrp'}, gst_values => \@gst_values, - gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0, + tax_rate => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0, listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice), total => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ), ecost => sprintf( "%.2f", $data->{ecost} || 0), diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index d815022..791ca05 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -162,15 +162,15 @@ if ( $bookseller->{listincgst} ) { $ecost = $order->{ecost}; $unitprice = $order->{unitprice}; } else { - $rrp = $order->{rrp} / ( 1 + $order->{gstrate} ); - $ecost = $order->{ecost} / ( 1 + $order->{gstrate} ); - $unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} ); + $rrp = $order->{rrp} / ( 1 + $order->{tax_rate} ); + $ecost = $order->{ecost} / ( 1 + $order->{tax_rate} ); + $unitprice = $order->{unitprice} / ( 1 + $order->{tax_rate} ); } } else { if ( $bookseller->{invoiceincgst} ) { - $rrp = $order->{rrp} * ( 1 + $order->{gstrate} ); - $ecost = $order->{ecost} * ( 1 + $order->{gstrate} ); - $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} ); + $rrp = $order->{rrp} * ( 1 + $order->{tax_rate} ); + $ecost = $order->{ecost} * ( 1 + $order->{tax_rate} ); + $unitprice = $order->{unitprice} * ( 1 + $order->{tax_rate} ); } else { $rrp = $order->{rrp}; $ecost = $order->{ecost}; diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 6dee09a..ffe41d8 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -111,28 +111,30 @@ unless( $invoiceid and $invoice->{invoiceid} ) { my $booksellerid = $invoice->{booksellerid}; my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid }); -my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; +my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist") // 0; my @orders = @{ $invoice->{orders} }; my $countlines = scalar @orders; my @loop_received = (); my @book_foot_loop; my %foot; -my $total_gste = 0; -my $total_gsti = 0; +my $total_tax_excluded = 0; +my $total_tax_included = 0; my $subtotal_for_funds; for my $order ( @orders ) { - $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 }); $order->{'unitprice'} += 0; if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) { - $order->{ecost} = $order->{ecostgste}; - $order->{unitprice} = $order->{unitpricegste}; + $order->{ecost} = $order->{ecost_tax_excluded}; + $order->{unitprice} = $order->{unitprice_tax_excluded}; } elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) { - $order->{ecost} = $order->{ecostgsti}; - $order->{unitprice} = $order->{unitpricegsti}; + $order->{ecost} = $order->{ecost_tax_included}; + $order->{unitprice} = $order->{unitprice_tax_included}; + } else { + $order->{ecost} = $order->{ecost_tax_excluded}; + $order->{unitprice} = $order->{unitprice_tax_excluded}; } $order->{total} = $order->{unitprice} * $order->{quantity}; @@ -145,10 +147,10 @@ for my $order ( @orders ) { $line{holds} += scalar( @$holds ); } $line{budget} = GetBudgetByOrderNumber( $line{ordernumber} ); - $foot{$line{gstrate}}{gstrate} = $line{gstrate}; - $foot{$line{gstrate}}{gstvalue} += $line{gstvalue}; - $total_gste += $line{totalgste}; - $total_gsti += $line{totalgsti}; + $foot{$line{tax_rate}}{tax_rate} = $line{tax_rate}; + $foot{$line{tax_rate}}{tax_value} += $line{tax_value}; + $total_tax_excluded += Koha::Number::Price->new( $line{ecost_tax_excluded} * $line{quantity} )->format; + $total_tax_included += Koha::Number::Price->new( $line{ecost_tax_included} * $line{quantity} )->format; my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); $line{suggestionid} = $suggestion->{suggestionid}; @@ -219,12 +221,13 @@ unless( defined $invoice->{closedate} ) { for (my $i = 0 ; $i < $countpendings ; $i++) { my $order = $pendingorders->[$i]; - $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 }); if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) { - $order->{ecost} = $order->{ecostgste}; + $order->{ecost} = $order->{ecost_tax_excluded}; } elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) { - $order->{ecost} = $order->{ecostgsti}; + $order->{ecost} = $order->{ecost_tax_included}; + } else { + $order->{ecost} = $order->{ecost_tax_excluded}; } $order->{total} = $order->{ecost} * $order->{quantity}; @@ -288,8 +291,8 @@ $template->param( loop_orders => \@loop_orders, book_foot_loop => \@book_foot_loop, (uc(C4::Context->preference("marcflavour"))) => 1, - total_gste => $total_gste, - total_gsti => $total_gsti, + total_tax_excluded => $total_tax_excluded, + total_tax_included => $total_tax_included, subtotal_for_funds => $subtotal_for_funds, sticky_filters => $sticky_filters, ); diff --git a/acqui/pdfformat/layout2pages.pm b/acqui/pdfformat/layout2pages.pm index 124a48a..d2fd2cd 100644 --- a/acqui/pdfformat/layout2pages.pm +++ b/acqui/pdfformat/layout2pages.pm @@ -96,11 +96,11 @@ sub printorders { $basket->{basketno}, $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ), $line->{quantity}, - Koha::Number::Price->new( $line->{rrpgsti} )->format, + Koha::Number::Price->new( $line->{rrp_tax_included} )->format, Koha::Number::Price->new( $line->{discount} )->format . '%', - Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%', - Koha::Number::Price->new( $line->{totalgste} )->format, - Koha::Number::Price->new( $line->{totalgsti} )->format, + Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%', + Koha::Number::Price->new( $line->{total_tax_excluded} )->format, + Koha::Number::Price->new( $line->{total_tax_included} )->format, ); push(@$abaskets, $arrbasket); } diff --git a/acqui/pdfformat/layout2pagesde.pm b/acqui/pdfformat/layout2pagesde.pm index 37706c3..f51599b 100644 --- a/acqui/pdfformat/layout2pagesde.pm +++ b/acqui/pdfformat/layout2pagesde.pm @@ -96,11 +96,11 @@ sub printorders { $basket->{basketno}, $titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ), $line->{quantity}, $line->{quantity}, - Koha::Number::Price->new( $line->{rrpgsti} )->format, + Koha::Number::Price->new( $line->{rrp_tax_included} )->format, Koha::Number::Price->new( $line->{discount} )->format . '%', - Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%', - Koha::Number::Price->new( $line->{totalgste} )->format, - Koha::Number::Price->new( $line->{totalgsti} )->format, + Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%', + Koha::Number::Price->new( $line->{total_tax_excluded} )->format, + Koha::Number::Price->new( $line->{total_tax_included} )->format, ); push(@$abaskets, $arrbasket); } diff --git a/acqui/pdfformat/layout3pages.pm b/acqui/pdfformat/layout3pages.pm index 230865c..e91d1e6 100644 --- a/acqui/pdfformat/layout3pages.pm +++ b/acqui/pdfformat/layout3pages.pm @@ -117,13 +117,13 @@ sub printorders { push( @$arrbasket, $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ), $line->{quantity}, - Koha::Number::Price->new( $line->{rrpgste} )->format, - Koha::Number::Price->new( $line->{rrpgsti} )->format, + Koha::Number::Price->new( $line->{rrp_tax_excluded} )->format, + Koha::Number::Price->new( $line->{rrp_tax_included} )->format, Koha::Number::Price->new( $line->{discount} )->format . '%', - Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format, - Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%', - Koha::Number::Price->new( $line->{totalgste} )->format, - Koha::Number::Price->new( $line->{totalgsti} )->format, + Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format, + Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%', + Koha::Number::Price->new( $line->{total_tax_excluded} )->format, + Koha::Number::Price->new( $line->{total_tax_included} )->format, ); push(@$abaskets, $arrbasket); } @@ -209,43 +209,43 @@ sub printbaskets { for my $bkey (@keys) { push(@$arrbasket, $bkey); } - my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount); + my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount); # calculate each basket total push(@$abaskets, $arrbasket); for my $basket (@$hbaskets) { my @gst; $arrbasket = undef; - my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount); + my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount); my $ords = $orders->{$basket->{basketno}}; my $ordlength = @$ords; foreach my $ord (@$ords) { - $totalgste += $ord->{totalgste}; - $totalgsti += $ord->{totalgsti}; - $totalgstvalue += $ord->{gstvalue}; - $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity}; - $totalrrpgste += $ord->{rrpgste} * $ord->{quantity}; - $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity}; - push @gst, $ord->{gstrate}; + $total_tax_excluded += $ord->{total_tax_excluded}; + $total_tax_included += $ord->{total_tax_included}; + $totaltax_value += $ord->{tax_value}; + $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity}; + $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity}; + $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity}; + push @gst, $ord->{tax_rate}; } @gst = uniq map { $_ * 100 } @gst; - $grandtotalrrpgste += $totalrrpgste; - $grandtotalrrpgsti += $totalrrpgsti; - $grandtotalgsti += $totalgsti; - $grandtotalgste += $totalgste; - $grandtotalgstvalue += $totalgstvalue; + $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded; + $grandtotal_rrp_tax_included += $total_rrp_tax_included; + $grandtotal_tax_included += $total_tax_included; + $grandtotal_tax_excluded += $total_tax_excluded; + $grandtotaltax_value += $totaltax_value; $grandtotaldiscount += $totaldiscount; my @gst_string = map { Koha::Number::Price->new($_)->format . '%' } @gst; push(@$arrbasket, $basket->{contractname}, $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')', - Koha::Number::Price->new( $totalrrpgste )->format, - Koha::Number::Price->new( $totalrrpgsti )->format, + Koha::Number::Price->new( $total_rrp_tax_excluded )->format, + Koha::Number::Price->new( $total_rrp_tax_included )->format, "@gst_string", - Koha::Number::Price->new( $totalgstvalue )->format, + Koha::Number::Price->new( $totaltax_value )->format, Koha::Number::Price->new( $totaldiscount )->format, - Koha::Number::Price->new( $totalgste )->format, - Koha::Number::Price->new( $totalgsti )->format, + Koha::Number::Price->new( $total_tax_excluded )->format, + Koha::Number::Price->new( $total_tax_included )->format, ); push(@$abaskets, $arrbasket); } @@ -254,13 +254,13 @@ sub printbaskets { push @$arrbasket, '', 'Total', - Koha::Number::Price->new( $grandtotalrrpgste )->format, - Koha::Number::Price->new( $grandtotalrrpgsti )->format, + Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format, + Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format, '', - Koha::Number::Price->new( $grandtotalgstvalue )->format, + Koha::Number::Price->new( $grandtotaltax_value )->format, Koha::Number::Price->new( $grandtotaldiscount )->format, - Koha::Number::Price->new( $grandtotalgste )->format, - Koha::Number::Price->new( $grandtotalgsti )->format; + Koha::Number::Price->new( $grandtotal_tax_excluded )->format, + Koha::Number::Price->new( $grandtotal_tax_included )->format; push @$abaskets,$arrbasket; # height is width and width is height in this function, as the pdf is in landscape mode for the Tables. diff --git a/acqui/pdfformat/layout3pagesfr.pm b/acqui/pdfformat/layout3pagesfr.pm index 93f1cf1..8b9bc20 100644 --- a/acqui/pdfformat/layout3pagesfr.pm +++ b/acqui/pdfformat/layout3pagesfr.pm @@ -117,13 +117,13 @@ sub printorders { push( @$arrbasket, $titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ), $line->{quantity}, - Koha::Number::Price->new( $line->{rrpgste})->format, - Koha::Number::Price->new( $line->{rrpgsti})->format, + Koha::Number::Price->new( $line->{rrp_tax_excluded})->format, + Koha::Number::Price->new( $line->{rrp_tax_included})->format, Koha::Number::Price->new( $line->{discount})->format.'%', - Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format, - Koha::Number::Price->new( $line->{gstrate} * 100)->format.'%', - Koha::Number::Price->new( $line->{totalgste})->format, - Koha::Number::Price->new( $line->{totalgsti})->format, + Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format, + Koha::Number::Price->new( $line->{tax_rate} * 100)->format.'%', + Koha::Number::Price->new( $line->{total_tax_excluded})->format, + Koha::Number::Price->new( $line->{total_tax_included})->format, ); push(@$abaskets, $arrbasket); } @@ -209,43 +209,43 @@ sub printbaskets { for my $bkey (@keys) { push(@$arrbasket, $bkey); } - my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount); + my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount); # calculate each basket total push(@$abaskets, $arrbasket); for my $basket (@$hbaskets) { my @gst; $arrbasket = undef; - my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount); + my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount); my $ords = $orders->{$basket->{basketno}}; my $ordlength = @$ords; foreach my $ord (@$ords) { - $totalgste += $ord->{totalgste}; - $totalgsti += $ord->{totalgsti}; - $totalgstvalue += $ord->{gstvalue}; - $totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity}; - $totalrrpgste += $ord->{rrpgste} * $ord->{quantity}; - $totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity}; - push @gst, $ord->{gstrate}; + $total_tax_excluded += $ord->{total_tax_excluded}; + $total_tax_included += $ord->{total_tax_included}; + $totaltax_value += $ord->{tax_value}; + $totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity}; + $total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity}; + $total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity}; + push @gst, $ord->{tax_rate}; } @gst = uniq map { $_ * 100 } @gst; - $grandtotalrrpgste += $totalrrpgste; - $grandtotalrrpgsti += $totalrrpgsti; - $grandtotalgsti += $totalgsti; - $grandtotalgste += $totalgste; - $grandtotalgstvalue += $totalgstvalue; + $grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded; + $grandtotal_rrp_tax_included += $total_rrp_tax_included; + $grandtotal_tax_included += $total_tax_included; + $grandtotal_tax_excluded += $total_tax_excluded; + $grandtotaltax_value += $totaltax_value; $grandtotaldiscount += $totaldiscount; my @gst_string = map { Koha::Number::Price->new($_)->format . '%' } @gst; push(@$arrbasket, $basket->{contractname}, $basket->{basketname} . ' (No. ' . $basket->{basketno} . ')', - Koha::Number::Price->new( $totalrrpgste )->format, - Koha::Number::Price->new( $totalrrpgsti )->format, + Koha::Number::Price->new( $total_rrp_tax_excluded )->format, + Koha::Number::Price->new( $total_rrp_tax_included )->format, "@gst_string", - Koha::Number::Price->new( $totalgstvalue )->format, + Koha::Number::Price->new( $totaltax_value )->format, Koha::Number::Price->new( $totaldiscount )->format, - Koha::Number::Price->new( $totalgste )->format, - Koha::Number::Price->new( $totalgsti )->format, + Koha::Number::Price->new( $total_tax_excluded )->format, + Koha::Number::Price->new( $total_tax_included )->format, ); push(@$abaskets, $arrbasket); } @@ -254,13 +254,13 @@ sub printbaskets { push @$arrbasket, '', 'Total', - Koha::Number::Price->new( $grandtotalrrpgste )->format, - Koha::Number::Price->new( $grandtotalrrpgsti )->format, + Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format, + Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format, '', - Koha::Number::Price->new( $grandtotalgstvalue )->format, + Koha::Number::Price->new( $grandtotaltax_value )->format, Koha::Number::Price->new( $grandtotaldiscount )->format, - Koha::Number::Price->new( $grandtotalgste )->format, - Koha::Number::Price->new( $grandtotalgsti )->format; + Koha::Number::Price->new( $grandtotal_tax_excluded )->format, + Koha::Number::Price->new( $grandtotal_tax_included )->format; push @$abaskets,$arrbasket; # height is width and width is height in this function, as the pdf is in landscape mode for the Tables. diff --git a/acqui/supplier.pl b/acqui/supplier.pl index 493c8af..d37bd72 100755 --- a/acqui/supplier.pl +++ b/acqui/supplier.pl @@ -82,7 +82,7 @@ if ( $op eq 'display' ) { $template->param( active => $supplier->{'active'}, - gstrate => $supplier->{'gstrate'} + 0.0, + tax_rate => $supplier->{'tax_rate'} + 0.0, invoiceprice => $supplier->{'invoiceprice'}, listprice => $supplier->{'listprice'}, basketcount => $supplier->{'basketcount'}, @@ -108,7 +108,7 @@ if ( $op eq 'display' ) { $template->param( # set active ON by default for supplier add (id empty for add) active => $booksellerid ? $supplier->{'active'} : 1, - gstrate => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0, + tax_rate => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0, gst_values => \@gst_values, currencies => \@currencies, enter => 1, diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl index c064f76..65cbe25 100755 --- a/acqui/updatesupplier.pl +++ b/acqui/updatesupplier.pl @@ -39,7 +39,7 @@ Here is the list : supplier, id, company, company_postal, physical, company_phone, physical, company_phone, company_fax, website, company_email, notes, status, publishers_imprints, list_currency, gst, list_gst, invoice_gst, -discount, gstrate, contact_name, contact_position, contact_phone, +discount, tax_rate, contact_name, contact_position, contact_phone, contact_altphone, contact_fax, contact_email, contact_notes, contact_claimacquisition, contact_claimissues, contact_acqprimary, contact_serialsprimary. @@ -90,7 +90,7 @@ $data{'gstreg'}=$input->param('gst'); $data{'listincgst'}=$input->param('list_gst'); $data{'invoiceincgst'}=$input->param('invoice_gst'); #have to transform this into fraction so it's easier to use -$data{'gstrate'} = $input->param('gstrate'); +$data{'tax_rate'} = $input->param('tax_rate'); $data{'discount'} = $input->param('discount'); $data{deliverytime} = $input->param('deliverytime'); $data{'active'}=$input->param('status'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index d43a959..55020ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -13,12 +13,12 @@ // No. Order - RRP tax exc. - ecost tax exc. - RRP tax inc. - ecost tax inc. + RRP tax exc. + ecost tax exc. + RRP tax inc. + ecost tax inc. Qty. - Total tax exc. ([% currency %]) - Total tax inc. ([% currency %]) + Total tax exc. ([% currency %]) + Total tax inc. ([% currency %]) GST % GST Fund @@ -455,16 +455,16 @@ [% FOREACH foot_loo IN book_foot_loop %] - Total (GST [% foot_loo.gstrate * 100 | $Price %]) -   -   -   -   + Total (GST [% foot_loo.tax_rate * 100 | $Price %]) +   +   +   +   [% foot_loo.quantity %] - [% foot_loo.totalgste | $Price%] - [% foot_loo.totalgsti | $Price %] + [% foot_loo.total_tax_excluded | $Price%] + [% foot_loo.total_tax_included | $Price %]   - [% foot_loo.gstvalue | $Price %] + [% foot_loo.tax_value | $Price %]     [% IF ( active ) %] @@ -478,15 +478,15 @@ Total ([% currency %]) -   -   -   -   +   +   +   +   [% total_quantity %] - [% total_gste | $Price %] - [% total_gsti | $Price %] + [% total_tax_excluded | $Price %] + [% total_tax_included | $Price %]   - [% total_gstvalue | $Price %] + [% total_tax_value | $Price %]     [% IF ( active ) %] @@ -552,15 +552,15 @@ [% 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 ... %] [%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %] - [% books_loo.rrpgste | $Price %] - [% books_loo.ecostgste | $Price%] - [% books_loo.rrpgsti | $Price %] - [% books_loo.ecostgsti | $Price %] + [% books_loo.rrp_tax_excluded | $Price %] + [% books_loo.ecost_tax_excluded | $Price%] + [% books_loo.rrp_tax_included | $Price %] + [% books_loo.ecost_tax_included | $Price %] [% books_loo.quantity %] - [% books_loo.totalgste | $Price %] - [% books_loo.totalgsti | $Price %] - [% books_loo.gstrate * 100 | $Price %] - [% books_loo.gstvalue | $Price %] + [% books_loo.total_tax_excluded | $Price %] + [% books_loo.total_tax_included | $Price %] + [% books_loo.tax_rate * 100 | $Price %] + [% books_loo.tax_value | $Price %] [% books_loo.budget_name %] [% books_loo.suppliers_report %] [% IF ( active ) %] @@ -614,13 +614,13 @@ No. Order - RRP tax exc. - ecost tax exc. - RRP tax inc. - ecost tax inc. + RRP tax exc. + ecost tax exc. + RRP tax inc. + ecost tax inc. Qty. - Total tax exc. ([% currency %]) - Total tax inc. ([% currency %]) + Total tax exc. ([% currency %]) + Total tax inc. ([% currency %]) GST % GST Fund @@ -665,15 +665,15 @@

[% END %] - [% order.rrpgste | $Price %] - [% order.ecostgste | $Price %] - [% order.rrpgsti | $Price %] - [% order.ecostgsti | $Price %] + [% order.rrp_tax_excluded | $Price %] + [% order.ecost_tax_excluded | $Price %] + [% order.rrp_tax_included | $Price %] + [% order.ecost_tax_included | $Price %] [% order.quantity %] - [% order.totalgste | $Price %] - [% order.totalgsti | $Price %] - [% order.gstrate * 100 | $Price %] - [% order.gstvalue | $Price %] + [% order.total_tax_excluded | $Price %] + [% order.total_tax_included | $Price %] + [% order.tax_rate * 100 | $Price %] + [% order.tax_value | $Price %] [% order.budget_name %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index 5b8ee46..609a1bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -12,12 +12,12 @@ // Summary Library - Actual cost tax exc. - Actual cost tax inc. + Actual cost tax exc. + Actual cost tax inc. Qty. - Total tax exc. ([% currency.symbol %]) - Total tax inc. ([% currency.symbol %]) + Total tax exc. ([% currency.symbol %]) + Total tax inc. ([% currency.symbol %]) GST % GST Fund @@ -168,13 +168,13 @@ [% END %]

[% order.branchcode %]

- [% order.unitpricegste | $Price %] - [% order.unitpricegsti | $Price %] + [% order.unitprice_tax_excluded | $Price %] + [% order.unitprice_tax_included | $Price %] [% order.quantity %] - [% order.totalgste | $Price %] - [% order.totalgsti | $Price %] - [% order.gstrate * 100 | $Price %] - [% order.gstvalue | $Price %] + [% order.total_tax_excluded | $Price %] + [% order.total_tax_included | $Price %] + [% order.tax_rate * 100 | $Price %] + [% order.tax_value | $Price %] [% order.budget_name %] [% END %] @@ -182,35 +182,35 @@ [% FOR tf IN foot_loop %] - Total (GST [% tf.gstrate * 100 | $Price %] %) - + Total (GST [% tf.tax_rate * 100 | $Price %] %) + [% tf.quantity %] - [% tf.totalgste | $Price %] - [% tf.totalgsti | $Price %] + [% tf.total_tax_excluded | $Price %] + [% tf.total_tax_included | $Price %]   - [% tf.gstvalue | $Price %] + [% tf.tax_value | $Price %]   [% END %] Total ([% currency.symbol %]) - + [% total_quantity %] - [% total_gste | $Price %] - [% total_gsti | $Price %] + [% total_tax_excluded | $Price %] + [% total_tax_included | $Price %]   - [% total_gstvalue | $Price %] + [% total_tax_value | $Price %]   Total + Shipment cost ([% currency.symbol %]) - - + + [% total_quantity %] - [% total_gste_shipment | $Price %] - [% total_gsti_shipment | $Price %] + [% total_tax_excluded_shipment | $Price %] + [% total_tax_included_shipment | $Price %]   - [% total_gstvalue | $Price %] + [% total_tax_value | $Price %]   diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index 805b1a6..00773c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -556,12 +556,12 @@ $(document).ready(function()
  • [% IF ( close ) %] Tax rate: - [% gstrate %]% + [% tax_rate %]% [% ELSE %] - - [% FOREACH gst IN gst_values %] - [% IF ( gst.option == gstrate ) %] + [% IF ( gst.option == tax_rate ) %] [% ELSE %] @@ -570,7 +570,7 @@ $(document).ready(function() [% END %] [% ELSE %] - +
  • [% END %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 42edebd..477094f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -262,7 +262,7 @@ - +
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index c66f2f2..57755df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -374,19 +374,19 @@ [% END %] Total tax exc. - [% total_gste | $Price %] + [% total_tax_excluded | $Price %] [% FOREACH book_foot IN book_foot_loop %] - Total (GST [% book_foot.gstrate * 100 | $Price %]%) - [% book_foot.gstvalue | $Price %] + Total (GST [% book_foot.tax_rate * 100 | $Price %]%) + [% book_foot.tax_value | $Price %] [% END %] Total tax inc. - [% total_gsti | $Price %] + [% total_tax_included | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index 02e143a..86f20db 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -274,10 +274,10 @@ function delete_contact(ev) { [% IF gst_values %]
    1. - - [% FOREACH gst IN gst_values %] - [% IF ( gstrate == gst.option ) %] + [% IF ( tax_rate == gst.option ) %] [% ELSE %] @@ -287,7 +287,7 @@ function delete_contact(ev) {
    [% ELSE %] - + [% END %]
    1. @@ -331,7 +331,7 @@ function delete_contact(ev) { [% END %]

      List prices are: [% listprice %]

      Invoice prices are: [% invoiceprice %]

      - [% IF ( gstrate ) %]

      Tax number registered: + [% IF ( tax_rate ) %]

      Tax number registered: [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]

      List item price includes tax: [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]

      @@ -340,7 +340,7 @@ function delete_contact(ev) {

      Discount: [% discount | format("%.1f") %] %

      Tax rate: - [% 0 + gstrate * 100 | format("%.1f") %] %

      + [% 0 + tax_rate * 100 | format("%.1f") %] %

      [% IF deliverytime.defined %]

      Delivery time: [% deliverytime %] days

      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt index edc6063..3dd1771 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/acqui/basket.tt @@ -81,7 +81,7 @@
    2. A basket with at least one uncertain price can't be closed.
    3. -
    4. If you are charged sales tax, choose that from the gstrate field
    5. +
    6. If you are charged sales tax, choose that from the tax_rate field
    7. 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.
    8. If you added Planning Values when creating the Fund, those values will appear in the two Planning Value fields.
    9. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 157c135..8c95459 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -359,8 +359,8 @@ $(document).ready(function() { Ordered amount - [% valuegste_ordered %] - [% valuegsti_ordered %] + [% value_tax_excluded_ordered %] + [% value_tax_included_ordered %] [% budget_name_ordered %] [% IF ( ordered_exists ) %] @@ -370,8 +370,8 @@ $(document).ready(function() { Spent amount - [% valuegste_spent %] - [% valuegsti_spent %] + [% value_tax_excluded_spent %] + [% value_tax_included_spent %] [% budget_name_spent %] [% IF ( spent_exists ) %] diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index 824ffc2..e511162 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -121,9 +121,9 @@ if ( defined $subscriptionid ) { if ( defined $lastOrderNotReceived ) { my $basket = GetBasket $lastOrderNotReceived->{basketno}; my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} }); - ( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller ); - $tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} ); - $tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} ); + ( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller ); + $tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} ); + $tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} ); $tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id}; $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno}; $tmpl_infos->{ordered_exists} = 1; @@ -131,9 +131,9 @@ if ( defined $subscriptionid ) { if ( defined $lastOrderReceived ) { my $basket = GetBasket $lastOrderReceived->{basketno}; my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} }); - ( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller ); - $tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} ); - $tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} ); + ( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller ); + $tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} ); + $tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} ); $tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id}; $tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid}; $tmpl_infos->{spent_exists} = 1; @@ -189,21 +189,21 @@ sub get_default_view { sub get_value_with_gst_params { my $value = shift; - my $gstrate = shift; + my $tax_rate = shift; my $bookseller = shift; if ( $bookseller->{listincgst} ) { - return ( $value, $value / ( 1 + $gstrate ) ); + return ( $value, $value / ( 1 + $tax_rate ) ); } else { - return ( $value * ( 1 + $gstrate ), $value ); + return ( $value * ( 1 + $tax_rate ), $value ); } } -sub get_gste { +sub get_tax_excluded { my $value = shift; - my $gstrate = shift; + my $tax_rate = shift; my $bookseller = shift; if ( $bookseller->{invoiceincgst} ) { - return $value / ( 1 + $gstrate ); + return $value / ( 1 + $tax_rate ); } else { return $value; } @@ -211,11 +211,11 @@ sub get_gste { sub get_gst { my $value = shift; - my $gstrate = shift; + my $tax_rate = shift; my $bookseller = shift; if ( $bookseller->{invoiceincgst} ) { - return $value / ( 1 + $gstrate ) * $gstrate; + return $value / ( 1 + $tax_rate ) * $tax_rate; } else { - return $value * ( 1 + $gstrate ) - $value; + return $value * ( 1 + $tax_rate ) - $value; } } diff --git a/t/Prices.t b/t/Prices.t index 74d2eac..61513d4 100644 --- a/t/Prices.t +++ b/t/Prices.t @@ -67,7 +67,7 @@ for my $currency_format ( qw( US FR ) ) { invoiceid => $invoiceid_0_0, rrp => 82.00, ecost => 73.80, - gstrate => 0.0500, + tax_rate => 0.0500, discount => 10.0000, datereceived => $today }; @@ -82,58 +82,58 @@ for my $currency_format ( qw( US FR ) ) { # Note that this configuration is correct \o/ compare( { - got => $order_0_0->{rrpgsti}, + got => $order_0_0->{rrp_tax_included}, expected => 86.10, conf => '0 0', - field => 'rrpgsti' + field => 'rrp_tax_included' } ); compare( { - got => $order_0_0->{rrpgste}, + got => $order_0_0->{rrp_tax_excluded}, expected => 82.00, conf => '0 0', - field => 'rrpgste' + field => 'rrp_tax_excluded' } ); compare( { - got => $order_0_0->{ecostgsti}, + got => $order_0_0->{ecost_tax_included}, expected => 77.49, conf => '0 0', - field => 'ecostgsti' + field => 'ecost_tax_included' } ); compare( { - got => $order_0_0->{ecostgste}, + got => $order_0_0->{ecost_tax_excluded}, expected => 73.80, conf => '0 0', - field => 'ecostgste' + field => 'ecost_tax_excluded' } ); compare( { - got => $order_0_0->{gstvalue}, + got => $order_0_0->{tax_value}, expected => 7.38, conf => '0 0', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_0_0->{totalgsti}, + got => $order_0_0->{total_tax_included}, expected => 154.98, conf => '0 0', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_0_0->{totalgste}, + got => $order_0_0->{total_tax_excluded}, expected => 147.60, conf => '0 0', - field => 'totalgste' + field => 'total_tax_excluded' } ); @@ -148,42 +148,42 @@ for my $currency_format ( qw( US FR ) ) { # Note that this configuration is correct \o/ compare( { - got => $order_0_0->{unitpricegsti}, + got => $order_0_0->{unitprice_tax_included}, expected => 77.49, conf => '0 0', - field => 'unitpricegsti' + field => 'unitprice_tax_included' } ); compare( { - got => $order_0_0->{unitpricegste}, + got => $order_0_0->{unitprice_tax_excluded}, expected => 73.80, conf => '0 0', - field => 'unitpricegste' + field => 'unitprice_tax_excluded' } ); compare( { - got => $order_0_0->{gstvalue}, + got => $order_0_0->{tax_value}, expected => 7.38, conf => '0 0', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_0_0->{totalgsti}, + got => $order_0_0->{total_tax_included}, expected => 154.98, conf => '0 0', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_0_0->{totalgste}, + got => $order_0_0->{total_tax_excluded}, expected => 147.60, conf => '0 0', - field => 'totalgste' + field => 'total_tax_excluded' } ); }; @@ -208,7 +208,7 @@ for my $currency_format ( qw( US FR ) ) { invoiceid => $invoiceid_1_1, rrp => 82.00, ecost => 73.80, - gstrate => 0.0500, + tax_rate => 0.0500, discount => 10.0000, datereceived => $today }; @@ -222,61 +222,61 @@ for my $currency_format ( qw( US FR ) ) { ); # Note that this configuration is *not* correct - # gstvalue should be 7.03 instead of 7.02 + # tax_value should be 7.03 instead of 7.02 compare( { - got => $order_1_1->{rrpgsti}, + got => $order_1_1->{rrp_tax_included}, expected => 82.00, conf => '1 1', - field => 'rrpgsti' + field => 'rrp_tax_included' } ); compare( { - got => $order_1_1->{rrpgste}, + got => $order_1_1->{rrp_tax_excluded}, expected => 78.10, conf => '1 1', - field => 'rrpgste' + field => 'rrp_tax_excluded' } ); compare( { - got => $order_1_1->{ecostgsti}, + got => $order_1_1->{ecost_tax_included}, expected => 73.80, conf => '1 1', - field => 'ecostgsti' + field => 'ecost_tax_included' } ); compare( { - got => $order_1_1->{ecostgste}, + got => $order_1_1->{ecost_tax_excluded}, expected => 70.29, conf => '1 1', - field => 'ecostgste' + field => 'ecost_tax_excluded' } ); compare( { - got => $order_1_1->{gstvalue}, + got => $order_1_1->{tax_value}, expected => 7.02, conf => '1 1', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_1_1->{totalgsti}, + got => $order_1_1->{total_tax_included}, expected => 147.60, conf => '1 1', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_1_1->{totalgste}, + got => $order_1_1->{total_tax_excluded}, expected => 140.58, conf => '1 1', - field => 'totalgste' + field => 'total_tax_excluded' } ); @@ -288,45 +288,45 @@ for my $currency_format ( qw( US FR ) ) { } ); # Note that this configuration is *not* correct! - # gstvalue should be 7.03 + # tax_value should be 7.03 compare( { - got => $order_1_1->{unitpricegsti}, + got => $order_1_1->{unitprice_tax_included}, expected => 73.80, conf => '1 1', - field => 'unitpricegsti' + field => 'unitprice_tax_included' } ); compare( { - got => $order_1_1->{unitpricegste}, + got => $order_1_1->{unitprice_tax_excluded}, expected => 70.29, conf => '1 1', - field => 'unitpricegste' + field => 'unitprice_tax_excluded' } ); compare( { - got => $order_1_1->{gstvalue}, + got => $order_1_1->{tax_value}, expected => 7.02, conf => '1 1', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_1_1->{totalgsti}, + got => $order_1_1->{total_tax_included}, expected => 147.60, conf => '1 1', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_1_1->{totalgste}, + got => $order_1_1->{total_tax_excluded}, expected => 140.58, conf => '1 1', - field => 'totalgste' + field => 'total_tax_excluded' } ); }; @@ -351,7 +351,7 @@ for my $currency_format ( qw( US FR ) ) { invoiceid => $invoiceid_1_1, rrp => 82.01, ecost => 73.80, - gstrate => 0.0500, + tax_rate => 0.0500, discount => 10.0000, datereceived => $today }; @@ -365,64 +365,63 @@ for my $currency_format ( qw( US FR ) ) { ); # Note that this configuration is *not* correct! - # rrp gsti should be 82 (what we inserted!) - # => Actually we need to fix the inserted value (here we have 82.01 in DB) - # gstvalue should be 7.03 instead of 7.02 + # rrp_tax_included should be 82 (what we inserted!) + # tax_value should be 7.03 instead of 7.02 compare( { - got => $order_1_0->{rrpgsti}, + got => $order_1_0->{rrp_tax_included}, expected => 82.01, conf => '1 0', - field => 'rrpgsti' + field => 'rrp_tax_included' } ); compare( { - got => $order_1_0->{rrpgste}, + got => $order_1_0->{rrp_tax_excluded}, expected => 78.10, conf => '1 0', - field => 'rrpgste' + field => 'rrp_tax_excluded' } ); compare( { - got => $order_1_0->{ecostgsti}, + got => $order_1_0->{ecost_tax_included}, expected => 73.80, conf => '1 0', - field => 'ecostgsti' + field => 'ecost_tax_included' } ); compare( { - got => $order_1_0->{ecostgste}, + got => $order_1_0->{ecost_tax_excluded}, expected => 70.29, conf => '1 0', - field => 'ecostgste' + field => 'ecost_tax_excluded' } ); compare( { - got => $order_1_0->{gstvalue}, + got => $order_1_0->{tax_value}, expected => 7.02, conf => '1 0', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_1_0->{totalgsti}, + got => $order_1_0->{total_tax_included}, expected => 147.60, conf => '1 0', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_1_0->{totalgste}, + got => $order_1_0->{total_tax_excluded}, expected => 140.58, conf => '1 0', - field => 'totalgste' + field => 'total_tax_excluded' } ); @@ -437,42 +436,42 @@ for my $currency_format ( qw( US FR ) ) { # gstvalue should be 7.03 compare( { - got => $order_1_0->{unitpricegsti}, + got => $order_1_0->{unitprice_tax_included}, expected => 73.80, conf => '1 0', - field => 'unitpricegsti' + field => 'unitprice_tax_included' } ); compare( { - got => $order_1_0->{unitpricegste}, + got => $order_1_0->{unitprice_tax_excluded}, expected => 70.29, conf => '1 0', - field => 'unitpricegste' + field => 'unitprice_tax_excluded' } ); compare( { - got => $order_1_0->{gstvalue}, + got => $order_1_0->{tax_value}, expected => 7.02, conf => '1 0', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_1_0->{totalgsti}, + got => $order_1_0->{total_tax_included}, expected => 147.60, conf => '1 0', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_1_0->{totalgste}, + got => $order_1_0->{total_tax_excluded}, expected => 140.58, conf => '1 0', - field => 'totalgste' + field => 'total_tax_excluded' } ); }; @@ -497,7 +496,7 @@ for my $currency_format ( qw( US FR ) ) { invoiceid => $invoiceid_1_1, rrp => 82.00, ecost => 73.80, - gstrate => 0.0500, + tax_rate => 0.0500, discount => 10.0000, datereceived => $today }; @@ -513,58 +512,58 @@ for my $currency_format ( qw( US FR ) ) { # Note that this configuration is correct \o/ compare( { - got => $order_0_1->{rrpgsti}, + got => $order_0_1->{rrp_tax_included}, expected => 86.10, conf => '1 0', - field => 'rrpgsti' + field => 'rrp_tax_included' } ); compare( { - got => $order_0_1->{rrpgste}, + got => $order_0_1->{rrp_tax_excluded}, expected => 82.00, conf => '1 0', - field => 'rrpgste' + field => 'rrp_tax_excluded' } ); compare( { - got => $order_0_1->{ecostgsti}, + got => $order_0_1->{ecost_tax_included}, expected => 77.49, conf => '1 0', - field => 'ecostgsti' + field => 'ecost_tax_included' } ); compare( { - got => $order_0_1->{ecostgste}, + got => $order_0_1->{ecost_tax_excluded}, expected => 73.80, conf => '1 0', - field => 'ecostgste' + field => 'ecost_tax_excluded' } ); compare( { - got => $order_0_1->{gstvalue}, + got => $order_0_1->{tax_value}, expected => 7.38, conf => '1 0', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_0_1->{totalgsti}, + got => $order_0_1->{total_tax_included}, expected => 154.98, conf => '1 0', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_0_1->{totalgste}, + got => $order_0_1->{total_tax_excluded}, expected => 147.60, conf => '1 0', - field => 'totalgste' + field => 'total_tax_excluded' } ); @@ -578,42 +577,42 @@ for my $currency_format ( qw( US FR ) ) { # Note that this configuration is correct compare( { - got => $order_0_1->{unitpricegsti}, + got => $order_0_1->{unitprice_tax_included}, expected => 77.49, conf => '0 1', - field => 'unitpricegsti' + field => 'unitprice_tax_included' } ); compare( { - got => $order_0_1->{unitpricegste}, + got => $order_0_1->{unitprice_tax_excluded}, expected => 73.80, conf => '0 1', - field => 'unitpricegste' + field => 'unitprice_tax_excluded' } ); compare( { - got => $order_0_1->{gstvalue}, + got => $order_0_1->{tax_value}, expected => 7.38, conf => '0 1', - field => 'gstvalue' + field => 'tax_value' } ); compare( { - got => $order_0_1->{totalgsti}, + got => $order_0_1->{total_tax_included}, expected => 154.98, conf => '0 1', - field => 'totalgsti' + field => 'total_tax_included' } ); compare( { - got => $order_0_1->{totalgste}, + got => $order_0_1->{total_tax_excluded}, expected => 147.60, conf => '0 1', - field => 'totalgste' + field => 'total_tax_excluded' } ); }; diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t index 6f1a0d2..5985cc4 100755 --- a/t/db_dependent/Acquisition.t +++ b/t/db_dependent/Acquisition.t @@ -189,7 +189,7 @@ my @order_content = ( ecost => 38.15, rrp => 40.15, discount => 5.1111, - gstrate => 0.0515 + tax_rate => 0.0515 } }, { @@ -217,7 +217,7 @@ my @order_content = ( ecost => 38.1, rrp => 11.0, discount => 5.1, - gstrate => 0.1 + tax_rate => 0.1 } }, { @@ -237,7 +237,7 @@ my @order_content = ( rrp => 11.00, discount => 0, uncertainprice => 0, - gstrate => 0 + tax_rate => 0 } }, { @@ -257,7 +257,7 @@ my @order_content = ( rrp => 10, discount => 0, uncertainprice => 0, - gstrate => 0 + tax_rate => 0 } } ); @@ -347,16 +347,23 @@ my @expectedfields = qw( invoiceid freight unitprice + unitprice_tax_included + unitprice_tax_excluded quantityreceived datecancellationprinted purchaseordernumber basketno timestamp rrp + rrp_tax_included + rrp_tax_excluded ecost + ecost_tax_included + ecost_tax_excluded unitpricesupplier unitpricelib - gstrate + tax_rate + tax_value discount budget_id budgetdate @@ -424,6 +431,8 @@ my @base_expectedfields = qw( notes ordernumber ecost + ecost_tax_included + ecost_tax_excluded uncertainprice marc url @@ -454,6 +463,8 @@ my @base_expectedfields = qw( budget_parent_id publishercode unitprice + unitprice_tax_included + unitprice_tax_excluded collectionvolume budget_amount budget_owner_id @@ -475,7 +486,8 @@ my @base_expectedfields = qw( suppliers_report agerestriction budget_branchcode - gstrate + tax_rate + tax_value listprice budget_code budgetdate @@ -498,6 +510,8 @@ my @base_expectedfields = qw( sort2_authcat budget_expend rrp + rrp_tax_included + rrp_tax_excluded cn_sort lccn sort1 @@ -585,6 +599,8 @@ ok( firstname biblioitemnumber ecost + ecost_tax_included + ecost_tax_excluded uncertainprice creationdate datereceived @@ -595,7 +611,8 @@ ok( suppliers_report isbn copyrightdate - gstrate + tax_rate + tax_value serial listprice budgetdate @@ -621,7 +638,11 @@ ok( unititle sort2_authcat rrp + rrp_tax_included + rrp_tax_excluded unitprice + unitprice_tax_included + unitprice_tax_excluded sort1 ordernumber datecreated @@ -647,15 +668,14 @@ my $invoiceid = AddInvoice( unknown => "unknown" ); +my $invoice = GetInvoice( $invoiceid ); + my ($datereceived, $new_ordernumber) = ModReceiveOrder( { biblionumber => $biblionumber4, - ordernumber => $ordernumbers[4], + order => GetOrder( $ordernumbers[4] ), quantityreceived => 1, - cost => 10, - ecost => 10, - invoiceid => $invoiceid, - rrp => 10, + invoice => $invoice, budget_id => $order_content[4]->{str}->{budget_id}, } ); @@ -813,20 +833,18 @@ is( "AddClaim : Check claimed_date" ); +my $order2 = GetOrder( $ordernumbers[1] ); +$order2->{order_internalnote} = "my notes"; ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber2, - ordernumber => $ordernumbers[1], + order => $order2, quantityreceived => 2, - cost => 12, - ecost => 12, - invoiceid => $invoiceid, - rrp => 42, - order_internalnote => "my notes", - order_vendornote => "my vendor notes", + invoice => $invoice, } -); -my $order2 = GetOrder( $ordernumbers[1] ); +) +; +$order2 = GetOrder( $ordernumbers[1] ); is( $order2->{'quantityreceived'}, 0, 'Splitting up order did not receive any on original order' ); is( $order2->{'quantity'}, 40, '40 items on original order' ); @@ -834,8 +852,6 @@ is( $order2->{'budget_id'}, $budgetid, 'Budget on original order is unchanged' ); is( $order2->{order_internalnote}, "my notes", 'ModReceiveOrder and GetOrder deal with internal notes' ); -is( $order2->{order_vendornote}, "my vendor notes", - 'ModReceiveOrder and GetOrder deal with vendor notes' ); $neworder = GetOrder($new_ordernumber); is( $neworder->{'quantity'}, 2, '2 items on new order' ); @@ -858,21 +874,19 @@ my $budgetid2 = C4::Budgets::AddBudget( } ); +my $order3 = GetOrder( $ordernumbers[2] ); +$order3->{order_internalnote} = "my other notes"; ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber2, - ordernumber => $ordernumbers[2], + order => $order3, quantityreceived => 2, - cost => 12, - ecost => 12, - invoiceid => $invoiceid, - rrp => 42, + invoice => $invoice, budget_id => $budgetid2, - order_internalnote => "my other notes", } ); -my $order3 = GetOrder( $ordernumbers[2] ); +$order3 = GetOrder( $ordernumbers[2] ); is( $order3->{'quantityreceived'}, 0, 'Splitting up order did not receive any on original order' ); is( $order3->{'quantity'}, 2, '2 items on original order' ); @@ -887,17 +901,15 @@ is( $neworder->{'quantityreceived'}, 2, 'Splitting up order received items on new order' ); is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' ); +$order3 = GetOrder( $ordernumbers[2] ); +$order3->{order_internalnote} = "my third notes"; ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber2, - ordernumber => $ordernumbers[2], + order => $order3, quantityreceived => 2, - cost => 12, - ecost => 12, - invoiceid => $invoiceid, - rrp => 42, + invoice => $invoice, budget_id => $budgetid2, - order_internalnote => "my third notes", } ); diff --git a/t/db_dependent/Acquisition/CancelReceipt.t b/t/db_dependent/Acquisition/CancelReceipt.t index e862fcc..9f7ad19 100644 --- a/t/db_dependent/Acquisition/CancelReceipt.t +++ b/t/db_dependent/Acquisition/CancelReceipt.t @@ -60,9 +60,8 @@ my $ordernumber = $order->{ordernumber}; ModReceiveOrder( { biblionumber => $biblionumber, - ordernumber => $ordernumber, + order => $order, quantityreceived => 2, - datereceived => dt_from_string } ); @@ -70,8 +69,7 @@ $order->add_item( $itemnumber ); CancelReceipt($ordernumber); -$order = GetOrder( $ordernumber ); -is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 0, "Create items on receiving: 0 item exist after cancelling a receipt"); +is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt"); my $itemnumber1 = AddItem({}, $biblionumber); my $itemnumber2 = AddItem({}, $biblionumber); @@ -103,9 +101,8 @@ is( my ( undef, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber, - ordernumber => $ordernumber, + order => $order, quantityreceived => 1, - datereceived => dt_from_string, received_items => [ $itemnumber1 ], } ); diff --git a/t/db_dependent/Acquisition/Invoices.t b/t/db_dependent/Acquisition/Invoices.t index cb54c97..a929ff3 100644 --- a/t/db_dependent/Acquisition/Invoices.t +++ b/t/db_dependent/Acquisition/Invoices.t @@ -91,26 +91,24 @@ my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $bookse shipmentdate => '2012-12-24', ); +my $invoice1 = GetInvoice( $invoiceid1 ); +my $invoice2 = GetInvoice( $invoiceid2 ); + my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber1, - ordernumber => $ordernumber1, + order => $order1, quantityreceived => 2, - cost => 12, - ecost => 12, - invoiceid => $invoiceid1, - rrp => 42 + invoice => $invoice1, } ); ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber2, - ordernumber => $ordernumber2, + order => $order2, quantityreceived => 1, - cost => 5, - ecost => 5, - invoiceid => $invoiceid2, + invoice => $invoice2, rrp => 42 } ); @@ -118,17 +116,14 @@ my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber3, - ordernumber => $ordernumber3, + order => $order3, quantityreceived => 1, - cost => 12, - ecost => 12, - invoiceid => $invoiceid2, - rrp => 42 + invoice => $invoice2, } ); -my $invoice1 = GetInvoiceDetails($invoiceid1); -my $invoice2 = GetInvoiceDetails($invoiceid2); +$invoice1 = GetInvoiceDetails($invoiceid1); +$invoice2 = GetInvoiceDetails($invoiceid2); is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order'); is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders'); diff --git a/t/db_dependent/Acquisition/OrderFromSubscription.t b/t/db_dependent/Acquisition/OrderFromSubscription.t index 91691a7..d0a970a 100644 --- a/t/db_dependent/Acquisition/OrderFromSubscription.t +++ b/t/db_dependent/Acquisition/OrderFromSubscription.t @@ -68,7 +68,7 @@ my $order = Koha::Acquisition::Order->new({ basketno => $basketno, rrp => $cost, ecost => $cost, - gstrate => 0.0500, + tax_rate => 0.0500, orderstatus => 'new', subscriptionid => $subscription->{subscriptionid}, budget_id => $budget_id, @@ -85,16 +85,16 @@ ok( $order->{ecost} == $cost, "test cost for the last order not received"); $dbh->do(q{DELETE FROM aqinvoices}); my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown"); +my $invoice = GetInvoice( $invoiceid ); +$invoice->{datereceived} = '02-01-2013'; + my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber, - ordernumber => $ordernumber, + order => $order, quantityreceived => 1, - cost => $cost, - ecost => $cost, - rrp => $cost, budget_id => $budget_id, - invoiceid => $invoiceid, + invoice => $invoice, } ); diff --git a/t/db_dependent/Acquisition/TransferOrder.t b/t/db_dependent/Acquisition/TransferOrder.t index fefbd00..efb8e00 100644 --- a/t/db_dependent/Acquisition/TransferOrder.t +++ b/t/db_dependent/Acquisition/TransferOrder.t @@ -95,11 +95,12 @@ $orders = SearchOrders({ ordernumber => $ordernumber }); is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' ); is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' ); +my $neworder = GetOrder( $newordernumber ); + ModReceiveOrder({ biblionumber => $biblionumber, - ordernumber => $newordernumber, + order => $neworder, quantityreceived => 2, - datereceived => dt_from_string(), }); CancelReceipt( $newordernumber ); $order = GetOrder( $newordernumber ); diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t index 3fa5be3..54765bd 100644 --- a/t/db_dependent/Bookseller.t +++ b/t/db_dependent/Bookseller.t @@ -63,7 +63,7 @@ my $sample_supplier1 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '1.0000', + tax_rate => '1.0000', discount => '1.0000', notes => 'notes1', deliverytime => undef @@ -83,7 +83,7 @@ my $sample_supplier2 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '2.0000', + tax_rate => '2.0000', discount => '2.0000', notes => 'notes2', deliverytime => 2 @@ -224,7 +224,7 @@ $sample_supplier2 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '2.0000 ', + tax_rate => '2.0000 ', discount => '2.0000', notes => 'notes2 modified', deliverytime => 2, @@ -264,7 +264,7 @@ my $sample_supplier3 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '3.0000', + tax_rate => '3.0000', discount => '3.0000', notes => 'notes3', deliverytime => 3 @@ -284,7 +284,7 @@ my $sample_supplier4 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '3.0000', + tax_rate => '3.0000', discount => '3.0000', notes => 'notes3', }; @@ -361,7 +361,7 @@ my $order1 = Koha::Acquisition::Order->new( entrydate => '01-01-2013', currency => 'EUR', notes => "This is a note1", - gstrate => 0.0500, + tax_rate => 0.0500, orderstatus => 1, subscriptionid => $id_subscription1, quantityreceived => 2, @@ -381,7 +381,7 @@ my $order2 = Koha::Acquisition::Order->new( entrydate => '01-01-2013', currency => 'EUR', notes => "This is a note2", - gstrate => 0.0500, + tax_rate => 0.0500, orderstatus => 1, subscriptionid => $id_subscription2, rrp => 10, @@ -399,7 +399,7 @@ my $order3 = Koha::Acquisition::Order->new( entrydate => '02-02-2013', currency => 'EUR', notes => "This is a note3", - gstrate => 0.0500, + tax_rate => 0.0500, orderstatus => 2, subscriptionid => $id_subscription3, rrp => 11, @@ -417,7 +417,7 @@ my $order4 = Koha::Acquisition::Order->new( entrydate => '02-02-2013', currency => 'EUR', notes => "This is a note3", - gstrate => 0.0500, + tax_rate => 0.0500, orderstatus => 2, subscriptionid => $id_subscription3, rrp => 11, diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index 8319c00..f2a0bcb 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -317,6 +317,7 @@ my @order_infos = ( my %budgets; my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown"); +my $invoice = GetInvoice( $invoiceid ); my $item_price = 10; my $item_quantity = 2; my $number_of_orders_to_move = 0; @@ -337,7 +338,7 @@ for my $infos (@order_infos) { rrp => $item_price, discount => 0, uncertainprice => 0, - gstrate => 0, + tax_rate => 0, } )->insert; my $ordernumber = $order->{ordernumber}; @@ -360,19 +361,16 @@ for my $infos (@order_infos) { rrp => $item_price, discount => 0, uncertainprice => 0, - gstrate => 0, + tax_rate => 0, } )->insert; my $ordernumber = $order->{ordernumber}; ModReceiveOrder({ biblionumber => $biblionumber, - ordernumber => $ordernumber, + order => $order, budget_id => $infos->{budget_id}, quantityreceived => $item_quantity, - cost => $item_price, - ecost => $item_price, - invoiceid => $invoiceid, - rrp => $item_price, + invoice => $invoice, received_items => [], } ); } diff --git a/t/db_dependent/Serials/Claims.t b/t/db_dependent/Serials/Claims.t index b887d78..80126a2 100644 --- a/t/db_dependent/Serials/Claims.t +++ b/t/db_dependent/Serials/Claims.t @@ -48,7 +48,7 @@ my $sample_supplier1 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '1.0000', + tax_rate => '1.0000', discount => '1.0000', notes => 'notes1', deliverytime => undef @@ -68,7 +68,7 @@ my $sample_supplier2 = { gstreg => 1, listincgst => 1, invoiceincgst => 1, - gstrate => '2.0000', + tax_rate => '2.0000', discount => '2.0000', notes => 'notes2', deliverytime => 2 -- 2.1.4