/** * Get report for some interval * * @param int $fromDate * @param int $toDate * @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection */ protected function _getReport($fromDate, $toDate) { if ($this->_reportCollection === null) { return []; } $reportResource = $this->_collectionFactory->create($this->_reportCollection); $reportResource->setDateRange($fromDate, $toDate)->setStoreIds($this->getStoreIds()); return $reportResource; }
/** * @return array */ public function getSubTotals() { $filterData = $this->getFilterData(); $subTotalsCollection = $this->_resourceFactory->create($this->getResourceCollectionName())->setPeriod($filterData->getData('period_type'))->setDateRange($filterData->getData('from', null), $filterData->getData('to', null))->addStoreFilter($this->_getStoreIds())->setAggregatedColumns($this->_getAggregatedColumns())->setIsSubTotals(true); $this->_addOrderStatusFilter($subTotalsCollection, $filterData); $this->_addCustomFilter($subTotalsCollection, $filterData); $this->setSubTotals($subTotalsCollection->getItems()); return parent::getSubTotals(); }