=item defaults entrydate to Now
-The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "biblioitemnumber", "rrp", "ecost", "gst", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "bookfundid".
+The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "biblioitemnumber", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "bookfundid".
=back
sub ModReceiveOrder {
my (
- $biblionumber, $ordernumber, $quantrec, $user, $cost,
+ $biblionumber, $ordernumber, $quantrec, $user, $cost, $ecost,
$invoiceid, $rrp, $budget_id, $datereceived, $received_items
)
= @_;
");
$sth->execute($order->{quantity} - $quantrec, $ordernumber);
+
$sth->finish;
delete $order->{'ordernumber'};
$order->{'invoiceid'} = $invoiceid;
$order->{'unitprice'} = $cost;
$order->{'rrp'} = $rrp;
+ $order->{ecost} = $ecost;
$order->{'orderstatus'} = 3; # totally received
$new_ordernumber = NewOrder($order);
} else {
$sth=$dbh->prepare("update aqorders
set quantityreceived=?,datereceived=?,invoiceid=?,
- unitprice=?,rrp=?
+ unitprice=?,rrp=?,ecost=?
where biblionumber=? and ordernumber=?");
- $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$biblionumber,$ordernumber);
+ $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
$sth->finish;
}
return ($datereceived, $new_ordernumber);
aqorders.listprice,
aqorders.rrp,
aqorders.ecost,
+ aqorders.gstrate,
biblio.title
FROM aqorders
LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
my $orderinfo = $input->Vars;
$orderinfo->{'list_price'} ||= 0;
$orderinfo->{'uncertainprice'} ||= 0;
-#my $ordernumber = $input->param('ordernumber');
-#my $basketno = $input->param('basketno');
-#my $booksellerid = $input->param('booksellerid');
-#my $existing = $input->param('existing'); # existing biblio, (not basket or order)
-#my $title = $input->param('title');
-#my $author = $input->param('author');
-#my $publicationyear= $input->param('publicationyear');
-#my $isbn = $input->param('ISBN');
-#my $itemtype = $input->param('format');
-#my $quantity = $input->param('quantity'); # FIXME: else ERROR!
-#my $branch = $input->param('branch');
-#my $series = $input->param('series');
-#my $notes = $input->param('notes');
-#my $budget_id = $input->param('budget_id');
-#my $sort1 = $input->param('sort1');
-#my $sort2 = $input->param('sort2');
-#my $rrp = $input->param('rrp');
-#my $ecost = $input->param('ecost');
-#my $gst = $input->param('GST');
-#my $budget = $input->param('budget');
-#my $cost = $input->param('cost');
-#my $sub = $input->param('sub');
-#my $purchaseorder = $input->param('purchaseordernumber');
-#my $invoice = $input->param('invoice');
-#my $publishercode = $input->param('publishercode');
-#my $suggestionid = $input->param('suggestionid');
-#my $biblionumber = $input->param('biblionumber');
-#my $uncertainprice = $input->param('uncertainprice');
-#my $import_batch_id= $input->param('import_batch_id');
-#
-#my $createbibitem = $input->param('createbibitem');
-#
-my $user = $input->remote_user;
+
+my $user = $input->remote_user;
+
# create, modify or delete biblio
# create if $quantity>=0 and $existing='no'
# modify if $quantity>=0 and $existing='yes'
"biblio.copyrightdate" => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
"biblioitems.itemtype" => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
"biblioitems.editionstatement"=> $$orderinfo{editionstatement} ? $$orderinfo{editionstatement} : "",
+ "aqorders.branchcode" => $$orderinfo{branchcode} ? $$orderinfo{branchcode} : "",
+ "aqorders.quantity" => $$orderinfo{quantity} ? $$orderinfo{quantity} : "",
+ "aqorders.listprice" => $$orderinfo{listprice} ? $$orderinfo{listprice} : "",
+ "aqorders.uncertainprice" => $$orderinfo{uncertainprice} ? $$orderinfo{uncertainprice} : "",
+ "aqorders.rrp" => $$orderinfo{rrp} ? $$orderinfo{rrp} : "",
+ "aqorders.ecost" => $$orderinfo{ecost} ? $$orderinfo{ecost} : "",
+ "aqorders.discount" => $$orderinfo{discount} ? $$orderinfo{discount} : "",
});
# create the record in catalogue, with framework ''
$orderinfo->{biblionumber}=$biblionumber;
}
+ $orderinfo->{unitprice} = $orderinfo->{ecost} if not defined $orderinfo->{unitprice} or $orderinfo->{unitprice} eq '';
+
# if we already have $ordernumber, then it's an ordermodif
if ($$orderinfo{ordernumber}) {
ModOrder( $orderinfo);
my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
if ($price){
- $orderinfo{'listprice'} = $price;
eval {
require C4::Acquisition;
import C4::Acquisition qw/GetBasket/;
}
my $basket = GetBasket( $orderinfo{basketno} );
my $bookseller = GetBookSellerFromId( $basket->{booksellerid} );
- my $gst = $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
- $orderinfo{'unitprice'} = $orderinfo{listprice} - ( $orderinfo{listprice} * ( $bookseller->{discount} / 100 ) );
- $orderinfo{'ecost'} = $orderinfo{unitprice};
+ $orderinfo{gstrate} = $bookseller->{gstrate};
+ if ( $bookseller->{listincgst} ) {
+ $orderinfo{ecost} = $price;
+ } else {
+ $orderinfo{ecost} = $price * ( 1 + $orderinfo{gstrate} );
+ }
+ $orderinfo{rrp} = ( $orderinfo{ecost} * 100 ) / ( 100 - $bookseller->{discount} );
+ $orderinfo{listprice} = $orderinfo{rrp};
+ $orderinfo{unitprice} = $orderinfo{ecost};
+ $orderinfo{total} = $orderinfo{ecost};
} else {
$orderinfo{'listprice'} = 0;
}
- $orderinfo{'rrp'} = $orderinfo{'listprice'};
# remove uncertainprice flag if we have found a price in the MARC record
$orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
"loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s",
$basket->{creationdate}, $basket->{authorisedby};
- #to get active currency
- my $cur = GetCurrency();
+ #to get active currency
+ my $cur = GetCurrency();
my @results = GetOrders( $basketno );
-
- my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
- $gist = 0 if $gist == 0.0000;
- my $discount = $bookseller->{'discount'} / 100;
- my $total_rrp = 0; # RRP Total, its value will be assigned to $total_rrp_gsti or $total_rrp_gste depending of $bookseller->{'listincgst'}
- my $total_rrp_gsti = 0; # RRP Total, GST included
- my $total_rrp_gste = 0; # RRP Total, GST excluded
- my $gist_rrp = 0;
- my $total_rrp_est = 0;
-
- my $qty_total;
my @books_loop;
- my $suggestion;
- for my $order ( @results ) {
- my $rrp = $order->{'listprice'} || 0;
- my $qty = $order->{'quantity'} || 0;
- if (!defined $order->{quantityreceived}) {
- $order->{quantityreceived} = 0;
- }
- for ( qw(rrp ecost quantityreceived)) {
- if (!defined $order->{$_}) {
- $order->{$_} = 0;
- }
- }
-
- my $budget = GetBudget( $order->{'budget_id'} );
- $rrp = ConvertCurrency( $order->{'currency'}, $rrp );
-
- $total_rrp += $qty * $order->{'rrp'};
- my $line_total = $qty * $order->{'ecost'};
- $total_rrp_est += $qty * $order->{'ecost'};
- # FIXME: what about the "actual cost" field?
- $qty_total += $qty;
- my %line = %{ $order };
- my $biblionumber = $order->{'biblionumber'};
- my $countbiblio = CountBiblioInOrders($biblionumber);
- my $ordernumber = $order->{'ordernumber'};
- my @subscriptions = GetSubscriptionsId ($biblionumber);
- my $itemcount = GetItemsCount($biblionumber);
- my $holds = GetHolds ($biblionumber);
- my @items = GetItemnumbersFromOrder( $ordernumber );
- my $itemholds;
- foreach my $item (@items){
- my $nb = GetItemHolds($biblionumber, $item);
- if ($nb){
- $itemholds += $nb;
- }
- }
- # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
- $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
- $line{items} = ($itemcount) - (scalar @items);
- $line{left_item} = 1 if $line{items} >= 1;
- $line{left_biblio} = 1 if $countbiblio > 1;
- $line{biblios} = $countbiblio - 1;
- $line{left_subscription} = 1 if scalar @subscriptions >= 1;
- $line{subscriptions} = scalar @subscriptions;
- ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
- $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
- $line{holds} = $holds;
- $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
- $line{order_received} = ( $qty == $order->{'quantityreceived'} );
- $line{basketno} = $basketno;
- $line{budget_name} = $budget->{budget_name};
- $line{rrp} = sprintf( "%.2f", $line{'rrp'} );
- $line{ecost} = sprintf( "%.2f", $line{'ecost'} );
- $line{line_total} = sprintf( "%.2f", $line_total );
- if ($line{uncertainprice}) {
+ my @book_foot_loop;
+ my %foot;
+ my $total_quantity = 0;
+ my $total_gste = 0;
+ my $total_gsti = 0;
+ my $total_gstvalue = 0;
+ for my $order (@results) {
+ my $line = get_order_infos( $order, $bookseller);
+ if ( $line->{uncertainprice} ) {
$template->param( uncertainprices => 1 );
- $line{rrp} .= ' (Uncertain)';
}
- if ($line{'title'}){
- my $volume = $order->{'volume'};
- my $seriestitle = $order->{'seriestitle'};
- $line{'title'} .= " / $seriestitle" if $seriestitle;
- $line{'title'} .= " / $volume" if $volume;
- } else {
- $line{'title'} = "Deleted bibliographic notice, can't find title.";
- }
-
- $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
- $line{suggestionid} = $suggestion->{suggestionid};
- $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby};
- $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
-
- push @books_loop, \%line;
+
+ push @books_loop, $line;
+
+ $foot{$$line{gstgsti}}{gstgsti} = $$line{gstgsti};
+ $foot{$$line{gstgsti}}{gstvalue} += $$line{gstvalue};
+ $total_gstvalue += $$line{gstvalue};
+ $foot{$$line{gstgsti}}{quantity} += $$line{quantity};
+ $total_quantity += $$line{quantity};
+ $foot{$$line{gstgsti}}{totalgste} += $$line{totalgste};
+ $total_gste += $$line{totalgste};
+ $foot{$$line{gstgsti}}{totalgsti} += $$line{totalgsti};
+ $total_gsti += $$line{totalgsti};
}
-my $total_est_gste;
- my $total_est_gsti;
- my $gist_est;
- if ($gist){ # if we have GST
- if ( $bookseller->{'listincgst'} ) { # if prices already includes GST
- $total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti
- $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values
- $gist_rrp = $total_rrp_gsti - $total_rrp_gste; #
- $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
- $total_est_gsti = $total_rrp_est;
- } else { # if prices does not include GST
- $total_rrp_gste = $total_rrp; # then we use the common way to compute other values
- $gist_rrp = $total_rrp_gste * $gist; #
- $total_rrp_gsti = $total_rrp_gste + $gist_rrp; #
- $total_est_gste = $total_rrp_est;
- $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
- }
- $gist_est = $gist_rrp - ( $gist_rrp * $discount );
- } else {
- $total_rrp_gsti = $total_rrp;
- $total_est_gsti = $total_rrp_est;
-}
+ push @book_foot_loop, map {$_} values %foot;
+
+ # Get cancelled orders
+ @results = GetCancelledOrders($basketno);
+ my @cancelledorders_loop;
+ for my $order (@results) {
+ my $line = get_order_infos( $order, $bookseller);
+ push @cancelledorders_loop, $line;
+ }
my $contract = &GetContract($basket->{contractnumber});
my @orders = GetOrders($basketno);
booksellerid => $bookseller->{'id'},
name => $bookseller->{'name'},
books_loop => \@books_loop,
+ book_foot_loop => \@book_foot_loop,
cancelledorders_loop => \@cancelledorders,
- gist_rate => sprintf( "%.2f", $gist * 100 ) . '%',
- total_rrp_gste => sprintf( "%.2f", $total_rrp_gste ),
- total_est_gste => sprintf( "%.2f", $total_est_gste ),
- gist_est => sprintf( "%.2f", $gist_est ),
- gist_rrp => sprintf( "%.2f", $gist_rrp ),
- total_rrp_gsti => sprintf( "%.2f", $total_rrp_gsti ),
- total_est_gsti => sprintf( "%.2f", $total_est_gsti ),
-# currency => $bookseller->{'listprice'},
- currency => $cur->{'currency'},
- qty_total => $qty_total,
- GST => $gist,
+ total_quantity => $total_quantity,
+ total_gste => sprintf( "%.2f", $total_gste ),
+ total_gsti => sprintf( "%.2f", $total_gsti ),
+ total_gstvalue => sprintf( "%.2f", $total_gstvalue ),
+ currency => $cur->{'currency'},
+ listincgst => $bookseller->{listincgst},
basketgroups => $basketgroups,
grouped => $basket->{basketgroupid},
unclosable => @orders ? 0 : 1,
);
}
+sub get_order_infos {
+ my $order = shift;
+ my $bookseller = shift;
+ my $qty = $order->{'quantity'} || 0;
+ if ( !defined $order->{quantityreceived} ) {
+ $order->{quantityreceived} = 0;
+ }
+ my $budget = GetBudget( $order->{'budget_id'} );
+
+ my %line = %{ $order };
+ $line{order_received} = ( $qty == $order->{'quantityreceived'} );
+ $line{basketno} = $basketno;
+ $line{budget_name} = $budget->{budget_name};
+ $line{rrp} = ConvertCurrency( $order->{'currency'}, $line{rrp} ); # FIXME from comm
+ if ( $bookseller->{'listincgst'} ) {
+ $line{rrpgsti} = sprintf( "%.2f", $line{rrp} );
+ $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
+ $line{rrpgste} = sprintf( "%.2f", $line{rrp} / ( 1 + ( $line{gstgsti} / 100 ) ) );
+ $line{gstgste} = sprintf( "%.2f", $line{gstgsti} / ( 1 + ( $line{gstgsti} / 100 ) ) );
+ $line{ecostgsti} = sprintf( "%.2f", $line{ecost} );
+ $line{ecostgste} = sprintf( "%.2f", $line{ecost} / ( 1 + ( $line{gstgsti} / 100 ) ) );
+ $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
+ $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
+ $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
+ } else {
+ $line{rrpgsti} = sprintf( "%.2f", $line{rrp} * ( 1 + ( $line{gstrate} ) ) );
+ $line{rrpgste} = sprintf( "%.2f", $line{rrp} );
+ $line{gstgsti} = sprintf( "%.2f", $line{gstrate} * 100 );
+ $line{gstgste} = sprintf( "%.2f", $line{gstrate} * 100 );
+ $line{ecostgsti} = sprintf( "%.2f", $line{ecost} * ( 1 + ( $line{gstrate} ) ) );
+ $line{ecostgste} = sprintf( "%.2f", $line{ecost} );
+ $line{gstvalue} = sprintf( "%.2f", ( $line{ecostgsti} - $line{ecostgste} ) * $line{quantity});
+ $line{totalgste} = sprintf( "%.2f", $order->{quantity} * $line{ecostgste} );
+ $line{totalgsti} = sprintf( "%.2f", $order->{quantity} * $line{ecostgsti} );
+ }
+
+ if ( $line{uncertainprice} ) {
+ $line{rrpgste} .= ' (Uncertain)';
+ }
+ if ( $line{'title'} ) {
+ my $volume = $order->{'volume'};
+ my $seriestitle = $order->{'seriestitle'};
+ $line{'title'} .= " / $seriestitle" if $seriestitle;
+ $line{'title'} .= " / $volume" if $volume;
+ } else {
+ $line{'title'} = "Deleted bibliographic notice, can't find title.";
+ }
+
+ my $biblionumber = $order->{'biblionumber'};
+ my $countbiblio = CountBiblioInOrders($biblionumber);
+ my $ordernumber = $order->{'ordernumber'};
+ my @subscriptions = GetSubscriptionsId ($biblionumber);
+ my $itemcount = GetItemsCount($biblionumber);
+ my $holds = GetHolds ($biblionumber);
+ my @items = GetItemnumbersFromOrder( $ordernumber );
+ my $itemholds;
+ foreach my $item (@items){
+ my $nb = GetItemHolds($biblionumber, $item);
+ if ($nb){
+ $itemholds += $nb;
+ }
+ }
+ # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
+ $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
+ $line{items} = ($itemcount) - (scalar @items);
+ $line{left_item} = 1 if $line{items} >= 1;
+ $line{left_biblio} = 1 if $countbiblio > 1;
+ $line{biblios} = $countbiblio - 1;
+ $line{left_subscription} = 1 if scalar @subscriptions >= 1;
+ $line{subscriptions} = scalar @subscriptions;
+ ($holds >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0;
+ $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
+ $line{holds} = $holds;
+ $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
+
+
+ my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
+ $line{suggestionid} = $$suggestion{suggestionid};
+ $line{surnamesuggestedby} = $$suggestion{surnamesuggestedby};
+ $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby};
+
+ return \%line;
+}
+
output_html_with_http_headers $query, $cookie, $template->output;
use C4::Context;
use C4::Acquisition;
use C4::Biblio;
+use C4::Bookseller;
use C4::Items;
use C4::Search;
use List::MoreUtils qw/any/;
checkauth($input, 0, $flagsrequired, 'intranet');
-my $user=$input->remote_user;
-my $biblionumber = $input->param('biblionumber');
-my $biblioitemnumber=$input->param('biblioitemnumber');
-my $ordernumber=$input->param('ordernumber');
-my $origquantityrec=$input->param('origquantityrec');
-my $quantityrec=$input->param('quantityrec');
-my $quantity=$input->param('quantity');
-my $unitprice=$input->param('cost');
-my $invoiceid = $input->param('invoiceid');
-my $invoice = GetInvoice($invoiceid);
-my $invoiceno = $invoice->{invoicenumber};
-my $datereceived= $invoice->{shipmentdate};
-my $replacement=$input->param('rrp');
-my $gst=$input->param('gst');
-my $booksellerid = $input->param('booksellerid');
-my $cnt=0;
-my $ecost = $input->param('ecost');
-my $note = $input->param("note");
+my $user = $input->remote_user;
+my $biblionumber = $input->param('biblionumber');
+my $biblioitemnumber = $input->param('biblioitemnumber');
+my $ordernumber = $input->param('ordernumber');
+my $origquantityrec = $input->param('origquantityrec');
+my $quantityrec = $input->param('quantityrec');
+my $quantity = $input->param('quantity');
+my $unitprice = $input->param('cost');
+my $invoiceid = $input->param('invoiceid');
+my $invoice = GetInvoice($invoiceid);
+my $invoiceno = $invoice->{invoicenumber};
+my $datereceived = $invoice->{shipmentdate};
+my $booksellerid = $input->param('booksellerid');
+my $cnt = 0;
+my $error_url_str;
+my $ecost = $input->param('ecost');
+my $rrp = $input->param('rrp');
+my $note = $input->param("note");
+my $order = GetOrder($ordernumber);
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
if ($quantityrec > $origquantityrec ) {
@received_items = $input->param('items_to_receive');
}
+ $order->{rrp} = $rrp;
+ $order->{ecost} = $ecost;
+ $order->{unitprice} = $unitprice;
+ my $bookseller = C4::Bookseller::GetBookSellerFromId($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} );
+ }
+ } 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} );
+ }
+ }
+
my $new_ordernumber = $ordernumber;
# save the quantity received.
if ( $quantityrec > 0 ) {
($datereceived, $new_ordernumber) = ModReceiveOrder(
- $biblionumber, $ordernumber, $quantityrec, $user, $unitprice,
- $invoiceid, $replacement, undef, $datereceived, \@received_items);
+ $biblionumber,
+ $ordernumber,
+ $quantityrec,
+ $user,
+ $order->{unitprice},
+ $order->{ecost},
+ $invoiceno,
+ $order->{rrp},
+ undef,
+ $datereceived,
+ \@received_items,
+ );
}
# now, add items if applicable
NewOrderItem($itemnumber, $new_ordernumber);
}
}
+
}
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
booksellerid => $booksellerid,
dateaccessioned => $datereceived,
price => $unitprice,
- replacementprice => $replacement,
+ replacementprice => $rrp,
replacementpricedate => $datereceived,
}, $biblionumber, $itemnumber );
}
budget_name => $budget_name
) if ($close);
+# get option values for gist syspref
+my @gst_values = map {
+ option => $_
+}, split( '\|', C4::Context->preference("gist") );
+
+my $cur = GetCurrency();
+
$template->param(
existing => $biblionumber,
ordernumber => $ordernumber,
suggestionid => $suggestion->{suggestionid},
surnamesuggestedby => $suggestion->{surnamesuggestedby},
firstnamesuggestedby => $suggestion->{firstnamesuggestedby},
- biblionumber => $biblionumber,
- uncertainprice => $data->{'uncertainprice'},
- authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'},
- biblioitemnumber => $data->{'biblioitemnumber'},
- discount_2dp => sprintf( "%.2f", $bookseller->{'discount'}) , # for display
- discount => $bookseller->{'discount'},
+ biblionumber => $biblionumber,
+ uncertainprice => $data->{'uncertainprice'},
+ authorisedbyname => $borrower->{'firstname'} . " " . $borrower->{'surname'},
+ biblioitemnumber => $data->{'biblioitemnumber'},
+ discount_2dp => sprintf( "%.2f", $bookseller->{'discount'} ) , # for display
+ discount => $bookseller->{'discount'},
+ orderdiscount_2dp => sprintf( "%.2f", $data->{'discount'} || 0 ),
+ orderdiscount => $data->{'discount'},
listincgst => $bookseller->{'listincgst'},
invoiceincgst => $bookseller->{'invoiceincgst'},
name => $bookseller->{'name'},
cur_active_sym => $active_currency->{'symbol'},
cur_active => $active_currency->{'currency'},
loop_currencies => \@loop_currency,
+ currency_rate => $cur->{rate},
orderexists => ( $new eq 'yes' ) ? 0 : 1,
title => $data->{'title'},
author => $data->{'author'},
quantity => $data->{'quantity'},
quantityrec => $data->{'quantity'},
rrp => $data->{'rrp'},
- listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
- total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
- ecost => $data->{'ecost'},
- unitprice => sprintf("%.2f", $data->{'unitprice'}||0),
+ gst_values => \@gst_values,
+ gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
+ gstreg => $bookseller->{'gstreg'},
+ listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
+ total => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
+ ecost => sprintf( "%.2f", $data->{ecost} || 0),
+ unitprice => sprintf( "%.2f", $data->{unitprice} || 0),
notes => $data->{'notes'},
publishercode => $data->{'publishercode'},
barcode_subfield => $barcode_subfield,
-
import_batch_id => $import_batch_id,
-
-# CHECKME: gst-stuff needs verifing, mason.
- gstrate => $bookseller->{'gstrate'} // C4::Context->preference("gist") // 0,
- gstreg => $bookseller->{'gstreg'},
(uc(C4::Context->preference("marcflavour"))) => 1
);
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
my $bookseller = GetBookSellerFromId($booksellerid);
-my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
my $results = SearchOrder($ordernumber,$search);
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
$template->param(items => \@items);
}
- if ( $order->{'unitprice'} == 0 ) {
- $order->{'unitprice'} = '';
- }
+ $order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
+ $order->{unitprice} = '' if $order->{unitprice} == 0;
+
+ my $rrp;
+ my $ecost;
+ my $unitprice;
+ if ( $bookseller->{listincgst} ) {
+ if ( $bookseller->{invoiceincgst} ) {
+ $rrp = $order->{rrp};
+ $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} );
+ }
+ } else {
+ if ( $bookseller->{invoiceincgst} ) {
+ $rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
+ $ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
+ $unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
+ } else {
+ $rrp = $order->{rrp};
+ $ecost = $order->{ecost};
+ $unitprice = $order->{unitprice};
+ }
+ }
- my $suggestion = GetSuggestionInfoFromBiblionumber($order->{'biblionumber'});
+ my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber});
- my $authorisedby = $order->{'authorisedby'};
+ my $authorisedby = $order->{authorisedby};
my $member = GetMember( borrowernumber => $authorisedby );
- my $budget = GetBudget( $order->{'budget_id'} );
+ my $budget = GetBudget( $order->{budget_id} );
$template->param(
AcqCreateItem => $AcqCreateItem,
biblioitemnumber => $order->{'biblioitemnumber'},
booksellerid => $order->{'booksellerid'},
freight => $freight,
- gst => $gst,
+ gstrate => $order->{gstrate} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0,
name => $bookseller->{'name'},
date => format_date($order->{entrydate}),
title => $order->{'title'},
quantity => $order->{'quantity'},
quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
quantityreceived => $order->{'quantityreceived'},
- rrp => $order->{'rrp'},
- ecost => sprintf( "%.2f",$order->{'ecost'}),
- unitprice => sprintf( "%.2f",$order->{'unitprice'}),
+ rrp => sprintf( "%.2f", $rrp ),
+ ecost => sprintf( "%.2f", $ecost ),
+ unitprice => sprintf( "%.2f", $unitprice),
memberfirstname => $member->{firstname} || "",
membersurname => $member->{surname} || "",
invoiceid => $invoice->{invoiceid},
$line{invoice} = $invoice->{invoicenumber};
$line{datereceived} = $datereceived->output();
$line{freight} = $freight;
- $line{gst} = $gst;
+ $line{gstrate} = @$results[$i]->{'gstrate'} || $bookseller->{gstrate} || C4::Context->preference("gist") || 0;
$line{title} = @$results[$i]->{'title'};
$line{author} = @$results[$i]->{'author'};
- $line{booksellerid} = $booksellerid;
+ $line{booksellerid} = $booksellerid;
push @loop, \%line;
}
my $input=new CGI;
+sub get_value_with_gst_params {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ if ( $bookseller->{listincgst} ) {
+ if ( $bookseller->{invoiceincgst} ) {
+ return $value;
+ } else {
+ return $value / ( 1 + $gstrate );
+ }
+ } else {
+ if ( $bookseller->{invoiceincgst} ) {
+ return $value * ( 1 + $gstrate );
+ } else {
+ return $value;
+ }
+ }
+}
+
+sub get_gste {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ return $bookseller->{invoiceincgst}
+ ? $value / ( 1 + $gstrate )
+ : $value;
+}
+
+sub get_gst {
+ my $value = shift;
+ my $gstrate = shift;
+ my $bookseller = shift;
+ return $bookseller->{invoiceincgst}
+ ? $value / ( 1 + $gstrate ) * $gstrate
+ : $value * ( 1 + $gstrate ) - $value;
+}
+
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "acqui/parcel.tmpl",
query => $input,
my $totalprice = 0;
my $totalquantity = 0;
my $total;
-my $tototal;
my @loop_received = ();
-
-for (my $i = 0 ; $i < $countlines ; $i++) {
-
- $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};
- $parcelitems[$i]->{'unitprice'} += 0;
+my @book_foot_loop;
+my %foot;
+my $total_quantity = 0;
+my $total_gste = 0;
+my $total_gsti = 0;
+
+for my $item ( @parcelitems ) {
+ $item->{unitprice} = get_value_with_gst_params( $item->{unitprice}, $item->{gstrate}, $bookseller );
+ $total = ( $item->{'unitprice'} ) * $item->{'quantityreceived'};
+ $item->{'unitprice'} += 0;
my %line;
- %line = %{ $parcelitems[$i] };
+ %line = %{ $item };
+ my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
+ $line{ecost} = sprintf( "%.2f", $ecost );
$line{invoice} = $invoice->{invoicenumber};
- $line{gst} = $gst;
$line{total} = sprintf($cfstr, $total);
$line{booksellerid} = $invoice->{booksellerid};
- $totalprice += $parcelitems[$i]->{'unitprice'};
- $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
+ $totalprice += $item->{'unitprice'};
+ $line{unitprice} = sprintf( $cfstr, $item->{'unitprice'} );
+ my $gste = get_gste( $line{total}, $line{gstrate}, $bookseller );
+ my $gst = get_gst( $line{total}, $line{gstrate}, $bookseller );
+ $foot{$line{gstrate}}{gstrate} = $line{gstrate};
+ $foot{$line{gstrate}}{value} += sprintf( "%.2f", $gst );
+ $total_quantity += $line{quantity};
+ $total_gste += $gste;
+ $total_gsti += $gste + $gst;
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
$line{suggestionid} = $suggestion->{suggestionid};
}
}
+ my $budget = GetBudget( $line{budget_id} );
+ $line{budget_name} = $budget->{'budget_name'};
+
push @loop_received, \%line;
- $totalquantity += $parcelitems[$i]->{'quantityreceived'};
- $tototal += $total;
+ $totalquantity += $item->{'quantityreceived'};
+
}
+push @book_foot_loop, map { $_ } values %foot;
+my @loop_orders = ();
if(!defined $invoice->{closedate}) {
my $pendingorders;
if($input->param('op') eq "search"){
}
my $countpendings = scalar @$pendingorders;
- # pending orders totals
- my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
- my $ordergrandtotal;
- my @loop_orders = ();
for (my $i = 0 ; $i < $countpendings ; $i++) {
my %line;
%line = %{$pendingorders->[$i]};
- $line{quantity}+=0;
- $line{quantityreceived}+=0;
+ my $ecost = get_value_with_gst_params( $line{ecost}, $line{gstrate}, $bookseller );
+ $line{unitprice} = get_value_with_gst_params( $line{unitprice}, $line{gstrate}, $bookseller );
+ $line{quantity} += 0;
+ $line{quantityreceived} += 0;
$line{unitprice}+=0;
- $totalPunitprice += $line{unitprice};
- $totalPquantity +=$line{quantity};
- $totalPqtyrcvd +=$line{quantityreceived};
- $totalPecost += $line{ecost};
- $line{ecost} = sprintf("%.2f",$line{ecost});
- $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
+ $line{ecost} = sprintf( "%.2f", $ecost );
+ $line{ordertotal} = sprintf( "%.2f", $ecost * $line{quantity} );
$line{unitprice} = sprintf("%.2f",$line{unitprice});
$line{invoice} = $invoice;
- $line{gst} = $gst;
- $line{total} = $total;
$line{booksellerid} = $booksellerid;
- $ordergrandtotal += $line{ecost} * $line{quantity};
+
+
my $biblionumber = $line{'biblionumber'};
my $countbiblio = CountBiblioInOrders($biblionumber);
$line{holds} = $holds;
$line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
+ my $budget = GetBudget( $line{budget_id} );
+ $line{budget_name} = $budget->{'budget_name'};
push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
}
}
$template->param(
- countpending => $countpendings,
loop_orders => \@loop_orders,
- ordergrandtotal => sprintf($cfstr, $ordergrandtotal),
- totalPunitprice => sprintf("%.2f", $totalPunitprice),
- totalPquantity => $totalPquantity,
- totalPqtyrcvd => $totalPqtyrcvd,
- totalPecost => sprintf("%.2f", $totalPecost),
);
}
-
$template->param(
invoiceid => $invoice->{invoiceid},
invoice => $invoice->{invoicenumber},
formatteddatereceived => $datereceived->output(),
name => $bookseller->{'name'},
booksellerid => $bookseller->{id},
- gst => $gst,
countreceived => $countlines,
loop_received => \@loop_received,
+ booksellerid => $booksellerid,
+ loop_orders => \@loop_orders,
+ book_foot_loop => \@book_foot_loop,
totalprice => sprintf($cfstr, $totalprice),
totalquantity => $totalquantity,
- tototal => sprintf($cfstr, $tototal),
- gst => $gst,
- grandtot => sprintf($cfstr, $tototal + $gst),
resultsperpage => $resultsperpage,
- (uc(C4::Context->preference("marcflavour"))) => 1
+ (uc(C4::Context->preference("marcflavour"))) => 1,
+ total_quantity => $total_quantity,
+ total_gste => sprintf( "%.2f", $total_gste ),
+ total_gsti => sprintf( "%.2f", $total_gsti ),
);
output_html_with_http_headers $input, $cookie, $template->output;
debug => 1,
}
);
-my $seller_gstrate = $supplier->{'gstrate'};
-# ensure the scalar isn't flagged as a string
-$seller_gstrate = ( defined $seller_gstrate ) ? $seller_gstrate + 0 : undef;
-my $tax_rate = $seller_gstrate // C4::Context->preference('gist') // 0;
-$tax_rate *= 100;
#build array for currencies
if ( $op eq 'display' ) {
gstreg => $supplier->{'gstreg'},
listincgst => $supplier->{'listincgst'},
invoiceincgst => $supplier->{'invoiceincgst'},
+ gstrate => $supplier->{'gstrate'} + 0.0,
discount => $supplier->{'discount'},
deliverytime => $supplier->{deliverytime},
invoiceprice => $supplier->{'invoiceprice'},
listprice => $supplier->{'listprice'},
- GST => $tax_rate,
- default_tax => defined($seller_gstrate),
basketcount => $supplier->{'basketcount'},
subscriptioncount => $supplier->{'subscriptioncount'},
contracts => $contracts,
};
}
- my $default_gst_rate = (C4::Context->preference('gist') * 100) || '0.0';
+ # get option values from gist syspref
+ my @gst_values = map {
+ option => $_
+ }, split( '\|', C4::Context->preference("gist") );
- my $gstrate = defined $supplier->{gstrate} ? $supplier->{gstrate} * 100 : '';
$template->param(
booksellerid => $booksellerid,
name => $supplier->{'name'},
gstreg => $supplier->{'gstreg'},
listincgst => $supplier->{'listincgst'},
invoiceincgst => $supplier->{'invoiceincgst'},
- gstrate => $gstrate,
+ gstrate => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
+ gst_values => \@gst_values,
discount => $supplier->{'discount'},
deliverytime => $supplier->{deliverytime},
loop_currency => $loop_currency,
- GST => $tax_rate,
enter => 1,
- default_gst_rate => $default_gst_rate,
);
}
$data{'listincgst'}=$input->param('list_gst');
$data{'invoiceincgst'}=$input->param('invoice_gst');
#have to transform this into fraction so it's easier to use
-my $gstrate = $input->param('gstrate');
-if ($gstrate eq '') {
- $data{'gstrate'} = undef;
-} else {
- $data{'gstrate'} = $input->param('gstrate')/100;
-}
-$data{'discount'}=$input->param('discount');
+$data{'gstrate'} = $input->param('gstrate');
+$data{'discount'} = $input->param('discount');
$data{deliverytime} = $input->param('deliverytime');
$data{'active'}=$input->param('status');
if($data{'name'}) {
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order line was last modified
`rrp` decimal(13,2) default NULL, -- the replacement cost for this line item
`ecost` decimal(13,2) default NULL, -- the estimated cost for this line item
- `gst` decimal(13,2) default NULL, -- the tax rate for this line item
+ `gstrate` decimal(6,4) default NULL, -- the tax rate for this line item
+ `discount` float(6,4) default NULL, -- the discount for this line item
`budget_id` int(11) NOT NULL, -- the fund this order goes against (aqbudgets.budget_id)
`budgetgroup_id` int(11) NOT NULL, -- not used? always zero
`budgetdate` date default NULL, -- not used? always NULL
$dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'");
print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n";
-
SetVersion($DBversion);
}
}
+$DBversion = "3.09.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4) DEFAULT NULL");
+ print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
+ print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)
// NEXT BLOCK IS USED BY NEWORDERBEMPTY
-function calcNeworderTotal(){
- //collect values
- var f = document.getElementById('Aform');
- var quantity = new Number(f.quantity.value);
- var discount = new Number(f.discount.value);
- var listinc = new Number (f.listinc.value);
- //var currency = f.currency.value;
- var applygst = new Number (f.applygst.value);
- var listprice = new Number(f.listprice.value);
- var invoiceingst = new Number (f.invoiceincgst.value);
-// var exchangerate = new Number(f.elements[currency].value); //get exchange rate
- var currcode = new String(document.getElementById('currency').value);
- var exchangerate = new Number(document.getElementById(currcode).value);
-
- var gst_on=(!listinc && invoiceingst);
-
- //do real stuff
+function updateCosts(){
+ var quantity = new Number($("#quantity").val());
+ var discount = new Number($("#discount").val());
+ var applygst = new Number ($("#applygst").val());
+ var listprice = new Number($("#listprice").val());
+ var exchangerate = new Number($("#currency_rate").val());
+ var gst_on=false;
+
var rrp = new Number(listprice*exchangerate);
var ecost = rrp;
- if (100-discount != 100) { //Prevent rounding issues if no discount
- ecost = new Number(Math.floor(rrp * (100 - discount ))/100);
+ if ( 100-discount != 100 ) { //Prevent rounding issues if no discount
+ ecost = new Number(Math.floor(rrp * (100 - discount )) / 100);
}
- var GST = new Number(0);
- if (gst_on) {
- rrp=rrp * (1+f.gstrate.value / 100);
- GST=ecost * f.gstrate.value / 100;
- }
-
- var total = new Number( (ecost + GST) * quantity);
+ var total = new Number( ecost * quantity);
+ $("#rrp").val(rrp.toFixed(2));
+ $("#ecost").val(ecost.toFixed(2));
+ $("#total").val(total.toFixed(2));
+ $("listprice").val(listprice.toFixed(2));
- f.rrp.value = rrp.toFixed(2);
-
-// f.rrp.value = rrp
-// f.rrp.value = 'moo'
-
- f.ecost.value = ecost.toFixed(2);
- f.total.value = total.toFixed(2);
- f.listprice.value = listprice.toFixed(2);
-
-// gst-stuff needs verifing, mason.
- if (f.GST) {
- f.GST.value=GST;
- }
return true;
}
[% ELSE %]
<li>
<label for="currency">Currency:</label>
- <select name="currency" id="currency" onchange="calcNeworderTotal();">
+ <select name="currency" id="currency">
[% FOREACH loop_currencie IN loop_currencies %]
[% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
</select>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
[% INCLUDE 'datatables-strings.inc' %]
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+
+<script type="text/javascript">
+//<![CDATA[
+ function updateColumnsVisibility(visible) {
+ if ( visible ) {
+ $("table .gste, .gsti").show();
+ } else {
+ [% IF ( listincgst ) %]
+ $("table .gste").hide();
+ [% ELSE %]
+ $("table .gsti").hide();
+ [% END %]
+ }
+ }
+
+ $(document).ready(function() {
+ $("#show_all_details").click(function(){
+ updateColumnsVisibility($(this+":checked").val());
+ });
+
+ $("#show_all_details").attr('checked', false);
+ updateColumnsVisibility(false);
+ });
+//]]>
+</script>
+
[% UNLESS ( closedate ) %]
<script type="text/javascript">
//<![CDATA[
[% UNLESS ( delete_confirm ) %]
<div id="acqui_basket_content" class="yui-g">
+ <label for="show_all_details">
+ <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
+ Show all details
+ </label>
<h2>Order Details</h2>
[% IF ( books_loop ) %]
<table id="orders">
<thead>
<tr>
<th>Order</th>
- <th>RRP</th>
- <th>Est.</th>
+ <th class="gste">RRP tax exc.</th>
+ <th class="gste">ecost tax exc.</th>
+ <th class="gsti">RRP tax inc.</th>
+ <th class="gsti">ecost tax inc.</th>
<th>Qty.</th>
- <th>Total</th>
+ <th class="gste">Total tax exc. ([% currency %])</th>
+ <th class="gsti">Total tax inc. ([% currency %])</th>
+ <th>GST %</th>
+ <th>GST</th>
<th>Fund</th>
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
</tr>
</thead>
<tfoot>
- [% IF ( GST ) %]
- <tr>
- <th scope="row">Total tax exc.</th>
- <td>[% total_rrp_gste %]</td>
- <td> </td>
- <td>[% qty_total %]</td>
- <td>[% total_est_gste %]</td>
+ [% FOREACH foot_loo IN book_foot_loop %]
+ <tr>
+ <th>Total (GST [% foot_loo.gstgsti %])</th>
+ <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
+ <th>[% foot_loo.quantity %]</th>
+ <th class="gste">[% foot_loo.totalgste %]</th>
+ <th class="gsti">[% foot_loo.totalgsti %]</th>
+ <th/>
+ <th>[% foot_loo.gstvalue %]</th>
+ <th/>
[% IF ( active ) %]
- [% IF ( closedate ) %]
- <td colspan="1" rowspan="3"> </td>
- [% ELSE %]
- <td colspan="3" rowspan="3"> </td>
+ [% UNLESS ( closedate ) %]
+ <th> </th>
+ <th> </th>
[% END %]
[% END %]
- </tr>
- <tr>
- <th scope="row">Tax ([% gist_rate %])</th>
- <td>[% gist_rrp %]</td>
- <td> </td>
- <td> </td>
- <td>[% gist_est %]</td>
- </tr>
- <tr>
- <th scope="row">Total tax inc. ([% currency %])</th>
- <td>[% total_rrp_gsti %]</td>
- <td> </td>
- <td>[% qty_total %]</td>
- <td>[% total_est_gsti %]</td>
- </tr>
- [% ELSE %]
+ </tr>
+ [% END %]
<tr>
- <th scope="row">Total ([% currency %])</th>
- <td>[% total_rrp_gsti %]</td>
- <td> </td>
- <td>[% qty_total %]</td>
- <td>[% total_est_gsti %]</td>
- <td colspan="3"> </td>
+ <th>Total ([% currency %])</th>
+ <th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
+ <th>[% total_quantity %]</th>
+ <th class="gste">[% total_gste %]</th>
+ <th class="gsti">[% total_gsti %]</th>
+ <th/>
+ <th>[% total_gstvalue %]</th>
+ <th/>
+ [% IF ( active ) %]
+ [% UNLESS ( closedate ) %]
+ <th> </th>
+ <th> </th>
+ [% END %]
+ [% END %]
</tr>
- [% END %]
</tfoot>
<tbody>
[% FOREACH books_loo IN books_loop %]
[% END %]
</p>
</td>
- <td class="number [% IF books_loo.rrp.search('^0') %]error[% END %]">[% books_loo.rrp %]</td>
- <td class="number [% IF books_loo.ecost.search('^0') %]error[% END %]">[% books_loo.ecost %]</td>
+ <td class="number gste [% IF books_loo.rrpgste.search('^0') %]error[% END %]">[% books_loo.rrpgste %]</td>
+ <td class="number gste [% IF books_loo.ecostgste.search('^0') %]error[% END %]">[% books_loo.ecostgste %]</td>
+ <td class="number gsti [% IF books_loo.rrpgsti.search('^0') %]error[% END %]">[% books_loo.rrpgsti %]</td>
+ <td class="number gsti [% IF books_loo.ecostgsti.search('^0') %]error[% END %]">[% books_loo.ecostgsti %]</td>
<td class="number [% IF books_loo.quantity.search('^0') %]error[% END %]">[% books_loo.quantity %]</td>
- <td class="number [% IF books_loo.line_total.search('^0') %]error[% END %]">[% books_loo.line_total %]</td>
+ <td class="number gste [% IF books_loo.totalgste.search('^0') %]error[% END %]">[% books_loo.totalgste %]</td>
+ <td class="number gsti [% IF books_loo.totalgsti.search('^0') %]error[% END %]">[% books_loo.totalgsti %]</td>
+ <td class="number [% IF books_loo.gstgsti.search('^0') %]error[% END %]">[% books_loo.gstgsti %]</td>
+ <td class="number [% IF books_loo.gstvalue.search('^0') %]error[% END %]">[% books_loo.gstvalue %]</td>
<td>[% books_loo.budget_name %]</td>
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
<thead>
<tr>
<th>Order</th>
- <th>RRP</th>
- <th>Est.</th>
+ <th class="gste">RRP tax exc.</th>
+ <th class="gste">ecost tax exc.</th>
+ <th class="gsti">RRP tax inc.</th>
+ <th class="gsti">ecost tax inc.</th>
<th>Qty.</th>
- <th>Total</th>
+ <th class="gste">Total tax exc. ([% currency %])</th>
+ <th class="gsti">Total tax inc. ([% currency %])</th>
+ <th>GST %</th>
+ <th>GST</th>
<th>Fund</th>
</tr>
</thead>
[% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
</p>
</td>
- <td><p>[% order.rrp %]</p></td>
- <td><p>[% order.ecost %]</p></td>
- <td><p>[% order.quantity %]</p></td>
- <td><p>[% order.line_total %]</p></td>
- <td><p>[% order.budget_name %]</p></td>
+ <td class="number gste">[% order.rrpgste %]</td>
+ <td class="number gste">[% order.ecostgste %]</td>
+ <td class="number gsti">[% order.rrpgsti %]</td>
+ <td class="number gsti">[% order.ecostgsti %]</td>
+ <td class="number">[% order.quantity %]</td>
+ <td class="number gste">[% order.totalgste %]</td>
+ <td class="number gsti">[% order.totalgsti %]</td>
+ <td class="number">[% order.gstgsti %]</td>
+ <td class="number">[% order.gstvalue %]</td>
+ <td>[% order.budget_name %]
</tr>
[% END %]
</tbody>
[% END %]
$("#quantity").change(function() {
- calcNeworderTotal();
+ updateCosts();
});
//We apply the fonction only for modify option
//]]>
</script>
</head>
-<body id="acq_neworderempty" class="acq">
+<body id="acq_neworderempty" class="acq" onload="updateCosts()">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="hidden" name="biblionumber" value="[% biblionumber %]" />
<input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
- <input type="hidden" name="discount" value="[% discount %]" />
- <input type="hidden" name="listinc" value="[% listincgst %]" />
-<!-- <input type="hidden" name="currency" value="[% currency %]" />-->
- <input type="hidden" name="applygst" value="[% gstreg %]" />
- <input type="hidden" name="invoiceincgst" value="[% invoiceincgst %]" />
- <input type="hidden" name="gstrate" value="[% gstrate %]" />
+ <input type="hidden" name="listinc" id="listinc" value="[% listincgst %]" />
+ <input type="hidden" name="applygst" id="applygst" value="[% gstreg %]" />
+ <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst %]" />
<input type="hidden" name="suggestionid" value="[% suggestionid %]" />
<input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
+ <input type="hidden" name="currency_rate" id="currency_rate" value="[% currency_rate %]" />
- [% FOREACH loop_currencie IN loop_currencies %]
- <input type="hidden" id="[% loop_currencie.currcode %]" name="[% loop_currencie.currcode %]" value="[% loop_currencie.rate %]" />
- [% END %]
<ol><li>
[% IF ( biblionumber ) %]
<span class="label">Title</span>
[% IF (AcqCreateItemOrdering) %]
<input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
[% ELSE %]
- <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" />
+ <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="updateCosts();" />
[% END %]
[% END %]
<!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
<input type="hidden" size="10" name="currency" id="currency" value="[% currency %]" />[% currency %]
[% ELSE %]
<label for="currency">Currency:</label>
- <select name="currency" id="currency" onchange="calcNeworderTotal();">
+ <select name="currency" id="currency" onchange="updateCosts();">
[% FOREACH loop_currencie IN loop_currencies %]
[% IF ( loop_currencie.selected ) %]<option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>[% ELSE %]<option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>[% END %][% END %]
</select>
</li>
<li>
[% IF ( close ) %]
- <span class="label">Vendor price: </span>
+ <span class="label">Vendor price: </span>
<input type="hidden" size="20" name="listprice" id="listprice" value="[% listprice %]" />[% listprice %]
[% ELSE %]
<label for="listprice">Vendor price: </label>
- <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="calcNeworderTotal()" />
+ <input type="text" size="20" name="listprice" id="listprice" value="[% listprice %]" onchange="updateCosts()" />
[% END %]
</li>
[% UNLESS ( close ) %]
[% END %]
</li>
[% END %]
- <li>
+ <li>
[% IF ( close ) %]
- <span class="label">Replacement cost: </span>
- <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
+ <span class="label">gstrate: </span>
+ <input type="hidden" size="20" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
[% ELSE %]
- <label for="rrp">Replacement cost: </label>
- <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
+ <label for="gst">gstrate: </label>
+ <select name="gstrate" id="gstrate" onchange="updateCosts();">
+ [% FOREACH gst IN gst_values %]
+ [% IF ( gst.option == gstrate ) %]
+ <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
+ [% ELSE %]
+ <option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
+ [% END %]
+ [% END %]
+ </select>
[% END %]
</li>
<li>
+ <label for="discount">Discount: </label>
[% IF ( close ) %]
- <label for="ecost">Budgeted cost: </label>
- <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly" />
+ [% IF ( orderdiscount ) %]
+ <input type="hidden" name="discount" id="discount" value="[% orderdiscount %]" />[% orderdiscount_2dp %]%
+ [% ELSE %]
+ <input type="hidden" name="discount" id="discount" value="[% discount %]" />[% discount_2dp %]%
+ [% END %]
[% ELSE %]
- <label for="ecost">Budgeted cost: </label>
- <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
+ [% IF ( orderdiscount ) %]
+ <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount %]" onchange="updateCosts();" />%
+ [% ELSE %]
+ <input type="text" size="6" name="discount" id="discount" value="[% discount %]" onchange="updateCosts();" />%
+ [% END %]
[% END %]
- [% IF ( discount_2dp ) %] (adjusted for [% discount_2dp %]% discount) [% END %]
-
</li>
- [% IF ( GST ) %]
<li>
[% IF ( close ) %]
- <label for="GST">Budgeted GST: </label>
- <input type="text" id="" size="20" name="gst" value="" id="GST" readonly="readonly" />
+ <span class="label">Replacement cost: </span>
+ <input type="hidden" size="20" name="rrp" id="rrp" value="[% rrp %]" />[% rrp %]
[% ELSE %]
- <label for="GST">Budgeted GST: </label>
- <input type="text" size="20" name="gst" id="GST" value="" />
+ <label for="rrp">Replacement cost: </label>
+ <input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /> (adjusted for [% cur_active %])
+ [% END %]
+ </li>
+ <li>
+ [% IF ( close ) %]
+ <label for="ecost">Budgeted cost: </label>
+ <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" readonly="readonly" />
+ [% ELSE %]
+ <label for="ecost">Budgeted cost: </label>
+ <input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" />
[% END %]
</li>
- [% END %]
<li>
[% IF ( close ) %]
- <label for="total">Total: </label>
- <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
+ <label for="total">Total: </label>
+ <input type="text" id="total" size="20" name="total" value="[% total %]" readonly="readonly" />
[% ELSE %]
- <label for="total">Total: </label>
- <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
+ <label for="total">Total: </label>
+ <input type="text" id="total" size="20" name="total" value="[% total %]" /> (budgeted cost * quantity)
[% END %]
</li>
<li>
[% IF ( close ) %]
- <label for="cost">Actual cost: </label>
- <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
+ <label for="unitprice">Actual cost: </label>
+ <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
[% ELSE %]
- <label for="cost">Actual cost: </label>
- <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
+ <label for="unitprice">Actual cost: </label>
+ <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
[% END %]
</li>
<li>
<input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
- <input type="hidden" name="gst" value="[% gst %]" />
+ <input type="hidden" name="gstrate" value="[% gstrate %]" />
</div>
<div class="yui-u">
<fieldset class="rows">
$(document).ready(function(){
var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
- { "aTargets": [ 3, 7, 8 ], "bSortable": false, "bSearchable": false },
+ { "aTargets": [ 3, 8, 9 ], "bSortable": false, "bSearchable": false },
],
"aoColumns": [
{ "sType": "num-html" },
null,
null,
null,
+ null,
],
"sPaginationType": "four_button"
} ) );
var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
- { "aTargets": [ 3 ], "bSortable": false, "bSearchable": false },
+ { "aTargets": [ 3, -1 ], "bSortable": false, "bSearchable": false },
],
"aoColumns": [
{ "sType": "num-html" },
],
"sPaginationType": "four_button"
} ) );
+/*
+ $("#pendingt").tablesorter({
+ headers: { 2: { sorter: 'articles' },3: { sorter: false },8:{sorter:false}}
+ });
+*/
rowCountPending = $("#pendingt tbody.filterclass tr").length;
rowCountReceived = $("#receivedt tbody.filterclass tr").length;
$("#pendingcollapserow").remove();
$("#pendingt tr").show();
$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
- $("#pendingt").before("<p id=\"pendingcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + "<a href=\"javascript:pendingExpand();\">" + _("Click here to show all ") + rowCountPending + _(" items") + "<\/a>.<\/p>");
+ $("#pendingt").before("<p id=\"pendingcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + " <a href=\"javascript:pendingExpand();\">" + _("Click here to show all ") + rowCountPending + _(" items") + "<\/a>.<\/p>");
}
$("#pendingcollapserow").remove();
$("#pendingt tr").show();
$("#pendingt tbody.filterclass tr.orderfound").remove();
- $("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + "<a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
+ $("#pendingt").before("<p id=\"pendingcollapserow\">" + rowCountPending + _(" items are displayed.") + " <a href=\"javascript:pendingCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
}
// Collapse already received items table
$.cookie("receivedKeepExpanded", 0, { path: "/", expires: 9999 });
$("#receivedcollapserow").remove();
$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
- $("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + "<a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
+ $("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + " <a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
}
// Expand already received items table
$.cookie("receivedKeepExpanded", 1, { path: "/", expires: 9999 });
$("#receivedcollapserow").remove();
$("#receivedt tr").show();
- $("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + "<a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
+ $("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + " <a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
}
//]]>
<th>Quantity</th>
<th>Unit cost</th>
<th>Order cost</th>
+ <th>Fund</th>
<th> </th>
<th> </th>
</tr>
</thead>
- <tfoot>
- <tr><td colspan="4" class="total">TOTAL</td>
- <td> [% totalPquantity %] </td>
- <td> </td>
- <td>[% ordergrandtotal %]</td>
- <td> </td>
- <td> </td>
- </tr>
- </tfoot>
<tbody class="filterclass">
[% FOREACH loop_order IN loop_orders %]
<tr>
<td>[% loop_order.quantity %]</td>
<td>[% loop_order.ecost %]</td>
<td>[% loop_order.ordertotal %]</td>
+ <td>[% loop_order.budget_name %]</td>
<td>
<a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&invoiceid=[% invoiceid %]">Receive</a>
-
</td>
<td>
[% IF ( loop_order.left_holds_on_order ) %]
</tr>
</thead>
<tfoot>
- <tr>
- <td colspan="4" class="total">SUBTOTAL</td>
- <td colspan="2"> </td>
- <td>[% totalprice %]</td>
- <td>[% tototal %]</td>
- <td></td>
- </tr>
-
- [% IF ( totalfreight ) %]
- <tr>
- <td colspan="6">
- </td>
- <td>Shipping</td>
- <td>[% totalfreight %]</td>
- </tr>
- [% END %]
- [% IF ( gst ) %]
- <tr>
- <td colspan="6">
- <p class="message">
- <b>HELP</b><br />
- The total at the bottom of the page should be within a few cents of the total for the invoice.
- </p>
- </td>
- <td><b>Tax rate</b></td>
- <td>[% gst %]</td>
- </tr>
- [% END %]
- <tr>
- <td colspan="4" class="total">TOTAL</td>
- <td>[% totalquantity %]</td>
- <td colspan="2"> </td>
- <td>[% grandtot %]</td>
- <td></td>
- </tr>
+ <tr>
+ <th colspan="7" class="total">Total tax exc.</th>
+ <th>[% total_gste %]</th>
+ <th></th>
+ </tr>
+ [% FOREACH book_foot IN book_foot_loop %]
+ <tr>
+ <th colspan="7">Total (GST [% book_foot.gstrate * 100 | format ("%.1f") %]%)</th>
+ <th>[% book_foot.value %]</th>
+ <th></th>
+ </tr>
+ [% END %]
+ <tr>
+ <th colspan="7" class="total">Total tax inc.</th>
+ <th>[% total_gsti %]</th>
+ <th></th>
+ </tr>
</tfoot>
<tbody class="filterclass">
[% FOREACH loop_receive IN loop_received %]
</li>
</ol>
<ol class="radio">
- <li><label for="gstyes" class="radio">Tax Number Registered:</label>
+ <li><label for="gstyes" class="radio">Tax number registered:</label>
[% IF ( gstreg ) %]
<label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
<label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
<label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
[% END %]</li>
</ol>
+ <ol>
+ <li>
+ <label for="gst">Tax rate</label>
+ <select name="gstrate" id="gstrate">
+ [% FOREACH gst IN gst_values %]
+ [% IF ( gstrate == gst.option ) %]
+ <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
+ [% ELSE %]
+ <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ </ol>
<ol>
<li><label for="discount">Discount</label>
<input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
- <li><label for="gstrate">Tax rate</label><input type="text" name="gstrate" id="gstrate" size="6" value="[% gstrate %]"/>% (leave blank for default tax of [% default_gst_rate %]%)</li>
<li>
<label for="deliverytime">Delivery time</label>
<input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
[% END %]</p>
<p><strong>List prices are: </strong>[% listprice %]</p>
<p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
- [% IF ( GST ) %]<p><strong>Tax number registered: </strong>
+ [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
<p><strong>List item price includes tax: </strong>
[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
<p><strong>Discount: </strong>
[% discount %] %</p>
<p><strong>Tax rate: </strong>
- [% GST %]%[% UNLESS ( default_tax ) %] (default)[% END %]</p>
+ [% 0 + gstrate * 100 | format("%.1f") %]%</p>
[% IF deliverytime.defined %]
<p><strong>Delivery time: </strong>
[% deliverytime %] days</p>
US: 360,000.00 (US)
FR: 360 000,00 (FR)
-
- - The default tax rate is
+ - Default tax rates are
- pref: gist
- - (enter in numeric form, 0.12 for 12%)
+ - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
Printing:
-
</div>
</div>
</div>
+ [% IF ( show_acquisition_details ) %]
+ <div id="acquisition_details">
+ <h2>Acquisition details</h2>
+ <table>
+ <thead>
+ <tr><th></th><th>Price exc. taxes</th><th>Price inc. taxes</th><th>fund</th><th></th></tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Ordered amount</td>
+ <td>[% valuegste_ordered %]</td>
+ <td>[% valuegsti_ordered %]</td>
+ <td>[% budget_name_ordered %]</td>
+ <td>
+ [% IF ( ordered_exists ) %]
+ <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">See basket informations</a>
+ [% END %]
+ </td>
+ </tr>
+ <tr>
+ <td>Spent amount</td>
+ <td>[% valuegste_spent %]</td>
+ <td>[% valuegsti_spent %]</td>
+ <td>[% budget_name_spent %]</td>
+ <td>
+ [% IF ( spent_exists ) %]
+ <a href="/cgi-bin/koha/acqui/invoice.pl?invoicenumber=[% invoicenumber %]">See invoice informations</a>
+ [% END %]
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ [% END %]
<div id="subscription_planning">
<div class="yui-g">
<div class="rows">
# COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ?
-for my $date qw(startdate enddate firstacquidate histstartdate histenddate){
+for my $date ( qw(startdate enddate firstacquidate histstartdate histenddate) ) {
$$subs{$date} = format_date($$subs{$date}) if $date && $$subs{$date};
}
$subs->{location} = GetKohaAuthorisedValueLib("LOC",$subs->{location});
$subs->{periodicity} = '0';
}
my $default_bib_view = get_default_view();
+
+my ( $order, $bookseller, $tmpl_infos );
+if ( defined $subscriptionid ) {
+ my $lastOrderNotReceived = GetLastOrderNotReceivedFromSubscriptionid $subscriptionid;
+ my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
+ if ( defined $lastOrderNotReceived ) {
+ my $basket = GetBasket $lastOrderNotReceived->{basketno};
+ my $bookseller = GetBookSellerFromId $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->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
+ $tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
+ $tmpl_infos->{ordered_exists} = 1;
+ }
+ if ( defined $lastOrderReceived ) {
+ my $basket = GetBasket $lastOrderReceived->{basketno};
+ my $bookseller = GetBookSellerFromId $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->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
+ $tmpl_infos->{invoicenumber} = $lastOrderReceived->{booksellerinvoicenumber};
+ $tmpl_infos->{spent_exists} = 1;
+ }
+}
+
$template->param(
subscriptionid => $subscriptionid,
serialslist => \@serialslist,
intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
irregular_issues => scalar @irregular_issues,
default_bib_view => $default_bib_view,
- (uc(C4::Context->preference("marcflavour"))) => 1
+ (uc(C4::Context->preference("marcflavour"))) => 1,
+ show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
);
output_html_with_http_headers $query, $cookie, $template->output;
undef, # $quantrec,
undef, # $user,
undef, # $cost,
+ undef, # $ecost,
$invoice, # $invoiceno,
undef, # $freight,
undef, # $rrp,
undef, # $quantrec,
undef, # $user,
undef, # $cost,
+ undef, # $ecost,
$param{'invoice'}, # $invoiceno,
undef, # $freight,
undef, # $rrp,