- #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;