@@ -, +, @@ workflow 0 - Apply patches and updatedatabase 1 - Add an order to a basket 2 - You should note new 'Retail price field' 3 - You should have a separate 'Replacement price' field 4 - Enter values and ensure they are saved as expected 5 - In the basket you should see the replacement price 6 - Modify order and ensure value is loaded and saved correctly 7 - Add and cancle an order and esure replacement price shows/saves 8 - Close basket 9 - Receive an order --- C4/Acquisition.pm | 8 ++++++++ acqui/addorderiso2709.pl | 8 ++++++-- acqui/finishreceive.pl | 6 +++++- acqui/neworderempty.pl | 2 ++ acqui/orderreceive.pl | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 6 ++++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt | 5 +++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 6 +++++- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt | 7 +++++++ 10 files changed, 51 insertions(+), 6 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -1506,6 +1506,10 @@ sub ModReceiveOrder { |; $query .= q| + , replacementprice = ? + | if defined $order->{replacementprice}; + + $query .= q| , unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ? | if defined $order->{unitprice}; @@ -1526,6 +1530,10 @@ sub ModReceiveOrder { my $sth = $dbh->prepare( $query ); my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, ( $budget_id ? $budget_id : $order->{budget_id} ) ); + if ( defined $order->{replacementprice} ) { + push @params, $order->{replacementprice}; + } + if ( defined $order->{unitprice} ) { push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded}; } --- a/acqui/addorderiso2709.pl +++ a/acqui/addorderiso2709.pl @@ -262,6 +262,7 @@ if ($op eq ""){ ); my $price = $infos->{price}; + my $replacementprice = $infos->{replacementprice}; if ($price){ # in France, the cents separator is the , but sometimes, ppl use a . # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation @@ -283,6 +284,7 @@ if ($op eq ""){ } else { $orderinfo{listprice} = 0; } + $orderinfo{replacementprice} = $replacementprice || 0; # remove uncertainprice flag if we have found a price in the MARC record $orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; @@ -511,8 +513,9 @@ sub import_biblios_list { my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; - my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']); + my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); my $price = $infos->{price}; + my $replacementprice = $infos->{replacementprice}; my $quantity = $infos->{quantity}; my $budget_code = $infos->{budget_code}; my $discount = $infos->{discount}; @@ -566,7 +569,7 @@ sub import_biblios_list { 'quantity' => $item_quantity, 'budget_code' => $item_budget_code || $budget_code, 'itemprice' => $item_price || $price, - 'replacementprice' => $item_replacement_price, + 'replacementprice' => $item_replacement_price || $replacementprice, 'itemcallnumber' => $item_callnumber, ); $all_items_quantity++; @@ -583,6 +586,7 @@ sub import_biblios_list { if ($alliteminfos == -1 || scalar(@$alliteminfos) == 0) { $cellrecord{price} = $price || ''; + $cellrecord{replacementprice} = $replacementprice || ''; $cellrecord{quantity} = $quantity || ''; $cellrecord{budget_id} = $budget_id || ''; $cellrecord{discount} = $discount || ''; --- a/acqui/finishreceive.pl +++ a/acqui/finishreceive.pl @@ -49,6 +49,7 @@ my $origquantityrec = $input->param('origquantityrec'); my $quantityrec = $input->param('quantityrec'); my $quantity = $input->param('quantity'); my $unitprice = $input->param('unitprice'); +my $replacementprice = $input->param('replacementprice'); my $datereceived = $input->param('datereceived'), my $invoiceid = $input->param('invoiceid'); my $invoice = GetInvoice($invoiceid); @@ -60,6 +61,8 @@ my $order = GetOrder($ordernumber); my $new_ordernumber = $ordernumber; $unitprice = Koha::Number::Price->new( $unitprice )->unformat(); +$replacementprice = Koha::Number::Price->new( $replacementprice )->unformat(); +warn "Replacement $replacementprice"; my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket; #need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME @@ -86,6 +89,7 @@ if ($quantityrec > $origquantityrec ) { $order->{order_internalnote} = $input->param("order_internalnote"); $order->{tax_rate_on_receiving} = $input->param("tax_rate"); + $order->{replacementprice} = $replacementprice; $order->{unitprice} = $unitprice; $order = C4::Acquisition::populate_order_with_prices( @@ -157,7 +161,7 @@ ModItem( dateaccessioned => $datereceived, datelastseen => $datereceived, price => $unitprice, - replacementprice => $order->{rrp}, + replacementprice => $replacementprice, replacementpricedate => $datereceived, }, $biblionumber, --- a/acqui/neworderempty.pl +++ a/acqui/neworderempty.pl @@ -268,6 +268,7 @@ if ( defined $subscriptionid ) { $data->{tax_rate} = $lastOrderReceived->{tax_rate_on_ordering}; $data->{discount} = $lastOrderReceived->{discount}; $data->{rrp} = $lastOrderReceived->{rrp}; + $data->{replacementprice} = $lastOrderReceived->{replacementprice}; $data->{ecost} = $lastOrderReceived->{ecost}; $data->{quantity} = $lastOrderReceived->{quantity}; $data->{unitprice} = $lastOrderReceived->{unitprice}; @@ -349,6 +350,7 @@ $template->param( quantity => $quantity, quantityrec => $quantity, rrp => $data->{'rrp'}, + replacementprice => $data->{'replacementprice'}, gst_values => \@gst_values, tax_rate => $data->{tax_rate_on_ordering} ? $data->{tax_rate_on_ordering}+0.0 : $bookseller->tax_rate ? $bookseller->tax_rate+0.0 : 0, listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice), --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -215,6 +215,7 @@ $template->param( quantityreceivedplus1 => $order->{'quantityreceived'} + 1, quantityreceived => $order->{'quantityreceived'}, rrp => $rrp, + replacementprice => $order->{'replacementprice'}, ecost => $ecost, unitprice => $unitprice, tax_rate => $tax_rate, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -353,6 +353,7 @@ ecost tax exc. RRP tax inc. ecost tax inc. + Replacement price Qty. Total tax exc. ([% currency %]) Total tax inc. ([% currency %]) @@ -377,6 +378,7 @@       +   [% foot_loo.quantity %] [% foot_loo.total_tax_excluded | $Price%] [% foot_loo.total_tax_included | $Price %] @@ -399,6 +401,7 @@       +   [% total_quantity %] [% total_tax_excluded | $Price %] [% total_tax_included | $Price %] @@ -474,6 +477,7 @@ [% books_loo.ecost_tax_excluded | $Price%] [% books_loo.rrp_tax_included | $Price %] [% books_loo.ecost_tax_included | $Price %] + [% books_loo.replacementprice | $Price %] [% books_loo.quantity %] [% books_loo.total_tax_excluded | $Price %] [% books_loo.total_tax_included | $Price %] @@ -536,6 +540,7 @@ ecost tax exc. RRP tax inc. ecost tax inc. + Replacement price Qty. Total tax exc. ([% currency %]) Total tax inc. ([% currency %]) @@ -588,6 +593,7 @@ [% order.ecost_tax_excluded | $Price %] [% order.rrp_tax_included | $Price %] [% order.ecost_tax_included | $Price %] + [% order.replacementprice | $Price %] [% order.quantity %] [% order.total_tax_excluded | $Price %] [% order.total_tax_included | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -98,6 +98,7 @@ Library Actual cost tax exc. Actual cost tax inc. + Replacement price Qty. Total tax exc. ([% currency.symbol %]) Total tax inc. ([% currency.symbol %]) @@ -128,6 +129,7 @@

[% order.branchcode %]

[% order.unitprice_tax_excluded | $Price %] [% order.unitprice_tax_included | $Price %] + [% order.replacementprice | $Price %] [% order.quantity %] [% order.total_tax_excluded | $Price %] [% order.total_tax_included | $Price %] @@ -142,6 +144,7 @@ Total (GST [% tf.tax_rate * 100 %] %) + [% tf.quantity %] [% tf.total_tax_excluded | $Price %] [% tf.total_tax_included | $Price %] @@ -153,6 +156,7 @@ Total ([% currency.symbol %]) + [% total_quantity %] [% total_tax_excluded | $Price %] [% total_tax_included | $Price %] @@ -164,6 +168,7 @@ Total + Shipment cost ([% currency.symbol %]) + [% total_quantity %] [% total_tax_excluded_shipment | $Price %] [% total_tax_included_shipment | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -598,14 +598,18 @@ $(document).ready(function()
  • [% IF ( close ) %] - Replacement cost: + Retail price: [% rrp %] (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) [% ELSE %] - + (adjusted for [% cur_active %], [% IF (listincgst == 1) %]tax inc.[% ELSE %]tax exc.[% END %]) [% END %]
  • + + +
  • +
  • [% IF (listincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -346,7 +346,11 @@ [% END %] -
  • [% rrp | $Price %]
  • +
  • [% rrp | $Price %]
  • +
  • + + +
  • [% ecost | $Price %]
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -40,6 +40,7 @@ null, null, null, + null, ], 'bAutoWidth': false, "sPaginationType": "four_button" @@ -56,6 +57,7 @@ { type: "text" }, { type: "text" }, { type: "text" }, + { type: "text" }, null, null ] @@ -233,6 +235,7 @@ Order line search Summary search   + Replacement price search Quantity search Unit cost search Order cost search @@ -246,6 +249,7 @@ Order line Summary View record + Replacement price Quantity Unit cost Order cost @@ -294,6 +298,7 @@ [% END %] MARC | Card + [% loop_order.replacementprice | $Price %] [% loop_order.quantity %] [% loop_order.ecost | $Price %] [% loop_order.total | $Price %] @@ -354,6 +359,7 @@ Holds Summary View record + Replacement price Quantity Fund Est cost @@ -435,6 +441,7 @@ [% END %] MARC | Card + [% order.replacementprice | $Price %] [% order.quantityreceived %] [% order.budget.budget_name %] [% order.ecost | $Price %] --