- push @loop_received, \%line;
- #double FIXME - totalfreight is redefined later.
-
-# FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
- if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) {
- warn "FREIGHT CHARGE MISMATCH!!";
- }
- $totalfreight = $parcelitems[$i]->{'freight'};
- $totalquantity += $parcelitems[$i]->{'quantityreceived'};
- $tototal += $total;
-}
-
-# We get the pending orders either all or filtered
-my $pendingorders;
-if($input->param('op') eq "search"){
- my $search = $input->param('summaryfilter') || '';
- my $ean = $input->param('eanfilter') || '';
- my $basketno = $input->param('basketfilter') || '';
- my $orderno = $input->param('orderfilter') || '';
- my $grouped;
- my $owner;
- $pendingorders = GetPendingOrders($booksellerid,$grouped,$owner,$basketno,$orderno,$search,$ean);
-}else{
- $pendingorders = GetPendingOrders($booksellerid);
-}
-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;
- $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{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);
- my $ordernumber = $line{'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;
- }
- }
-
- my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
- $line{suggestionid} = $suggestion->{suggestionid};
- $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby};
- $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
-
- # 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;
- $line{left_holds} = 1 if $holds >= 1;
- $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};
-
-
- push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
-}
-$freight = $totalfreight unless $freight;
-my $count = $countpendings;
-
-if ($count>$resultsperpage){
- my $displaynext=0;
- my $displayprev=$startfrom;
- if(($count - ($startfrom+$resultsperpage)) > 0 ) {
- $displaynext = 1;
- }