Return the inventory unsold items view.

@return \Illuminate\View\View
186393
public function getUnsold()
    {
        $items = Auth::user()->items()
            ->with('purchases')
            ->where(function ($query) {
                $query->has('purchases', 0)
                    ->where('end_date', '<', time())
                    ->where('auction', false)
                    ->orWhere(function ($query) {
                        $query->where('auction', true)
                            ->where('end_date', '<', time())
                            ->where('winning_bid_id', 0);
                    });
            });

        $table = new InventoryUnsold($items);

        return view('mustard::inventory.unsold', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
73781
private function getUnsortedProductData()
    {
        $productCollection = $this->getProductCollection()->setPageSize($this->size);

        if (!in_array($this->search, [null, ''])) {
            $productCollection->setSearchQuery($this->search);
        }

        return ['products' => $productCollection->getItems(), 'size' => $productCollection->getSize()];
    }
1146602
public function getLastCartItemAdded()
    {
        return CartItemQuery::create()
            ->filterByCartId($this->getId())
            ->orderByCreatedAt(Criteria::DESC)
            ->findOne()
        ;
    }
30490
public function &GetFieldShopStockMessage()
    {
        $oItem = $this->GetFromInternalCache('oLookupshop_stock_message_id');
        if (null === $oItem) {
            $oItem = $this->getShopStockMessageDataAccess()->getStockMessage($this->fieldShopStockMessageId, $this->iLanguageId);
            if (null !== $oItem) {
                $this->SetInternalCache('oLookupshop_stock_message_id', $oItem);
            }
        }
        if (null !== $oItem && false === $oItem->GetArticle()) {
            $oItem->SetArticle($this);
        }

        if (null !== $oItem && false === is_array($oItem->sqlData)) {
            $oItem = null;
        }

        return $oItem;
    }
71094
public function getStockistId()
    {
        try {
            return $this->stockistRepository->getById(
                $this->context->getRequest()->getParam('stockist_id')
            )->getId();
        } catch (NoSuchEntityException $e) {
            return null;
        }
    }
227216
public function getStoresForFrontend()
    {
        $collection = $this->stockistsCollectionFactory->create()
            ->addFieldToSelect('*')
            ->addFieldToFilter('store_id', $this->getStoreId())
            ->addFieldToFilter('status', Stores::STATUS_ENABLED)
            ->setOrder('name', 'ASC');
        return $collection;
    }
641109
public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
373938
protected function getListItems()
    {
        $changesets = ChangeSet::get();
        // Filter out published items if disabled
        if (!$this->config()->get('show_published')) {
            $changesets = $changesets->filter('State', ChangeSet::STATE_OPEN);
        }
        // Filter out automatically created changesets
        if (!$this->config()->get('show_inferred')) {
            $changesets = $changesets->filter('IsInferred', 0);
        }
        return $changesets
            ->filterByCallback(function ($item) {
                /** @var ChangeSet $item */
                return ($item->canView());
            });
    }
114989
public function showAction(Inventory $inventory)
    {
        $products = $inventory->getItems();
        $editForm = $this->createForm(new InventoryType(), $inventory, array(
            'action' => $this->generateUrl('stock_inventory_update', array('id' => $inventory->getid())),
            'method' => 'PUT',
        ));
        $editItemsForm = $this->createForm(new InventoryItemsType(), $inventory, array(
            'action' => $this->generateUrl('stock_inventory_item_update', array('id' => $inventory->getid())),
            'method' => 'PUT',
        ));
        $deleteForm = $this->createDeleteForm($inventory->getId(), 'stock_inventory_delete');

        return array(

            'inventory' => $inventory,
            'products' => $products,
            'edit_form' => $editForm->createView(),
            'edit_items_form' => $editItemsForm->createView(),
            'delete_form' => $deleteForm->createView(),

        );
    }
444309
public function getTotalItems()
    {
        $total = 0;
        
        foreach ($this->items as $item) {
            $total += ($item->Quantity) ? $item->Quantity : 1;
        }

        return $total;
    }
1075559
public function get()
	{
		$view = $this->getView();

		try
		{
			$total = 0;
			$params = $this->storeSearchParams( $view->param( 'uo', [] ), 'customerorder' );
			$orderItems = $this->getOrderItems( $view->item, $params, $total );
			$baseItems = $this->getOrderBaseItems( $orderItems );

			$view->orderItems = $orderItems;
			$view->orderBaseItems = $baseItems;
			$view->orderTotal = $total;
			$view->orderBody = '';

			foreach( $this->getSubClients() as $client ) {
				$view->orderBody .= $client->search();
			}
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$error = array( 'customer-order' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->errors = $view->get( 'errors', [] ) + $error;
			$this->logException( $e );
		}
		catch( \Exception $e )
		{
			$error = array( 'customer-order' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
			$view->errors = $view->get( 'errors', [] ) + $error;
			$this->logException( $e );
		}

		return $this->render( $view );
	}
821697
public function getDiscountAmount()
    {
        $total = 0;
        $discount = 0;
        
        foreach ($this->items as $item) {
            if ($item->Price) {
                $total += ($item->Price * $item->Quantity);
            }
            
            if ($item->Discount) {
                $discount += ($item->TotalDiscount);
            }
        }
        
        if ($discount > $total) {
            $discount = $total;
        }

        return $discount;
    }
423847
public function getBought()
    {
        $items = Item::join('seller')
            ->leftJoin('purchases')
            ->where('purchases.user_id', Auth::user()->userId);

        if (mustard_loaded('auctions')) {
            $items->leftJoin('winningBid')
                ->orWhere('bids.user_id', Auth::user()->userId);
        }

        $table = new InventoryBought($items);

        return view('mustard::inventory.bought', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
799476
public function getItemCount()
    {
        if (null === $this->itemCount) {
            $this->itemCount = (int) $this->paginator->count();
        }

        return $this->itemCount;
    }
4893
public function getEnded()
    {
        $items = Auth::user()->items()->where('end_date', '<', time());

        $table = new InventoryEnded($items);

        return view('mustard::inventory.ended', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
1243930
public function getTotalItems()
    {
        $total = 0;

        foreach ($this->Items() as $item) {
            $total += ($item->Quantity) ? $item->Quantity : 1;
        }

        $this->extend("updateTotalItems", $total);

        return $total;
    }
582436
public function showItemsTable()
    {
        $table = new AdminItems(Item::query());

        $table->with('seller');

        if (mustard_loaded('feedback')) {
            $table->with('seller.feedbackReceived');
        }

        return view('mustard::admin.items', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }