protected function prepareData()
 {
     $this->items = $this->prepareValues();
     $this->collection->map(function (ReportRow $row) {
         $this->items[$row->getIdentifier()]['value'] += $row->getValue();
     });
 }
 public function getSummary()
 {
     $totalValue = $this->getCollectionValue($this->collection);
     $totalCount = $this->collection->count();
     $currentCollection = $this->filterCurrentItems($this->collection);
     $currentCount = $currentCollection->count();
     $currentValue = $this->getCollectionValue($currentCollection);
     return ['totalValue' => $totalValue, 'currentValue' => $currentValue, 'totalCount' => $totalCount, 'currentCount' => $currentCount];
 }
 /**
  * {@inheritdoc}
  */
 public function getReport(ReportConfiguration $configuration)
 {
     $criteria = $this->getCriteria($configuration);
     $collection = $this->repository->matching($criteria);
     $report = new ReportRowCollection();
     $collection->map(function (ClientInterface $client) use($report) {
         $ordersTotal = $this->calculateOrdersAmountForClient($client);
         $identifier = $client->getFirstName() . ' ' . $client->getLastName();
         $report->add(new ReportRow($identifier, $ordersTotal));
     });
     return $report;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function getReport(ReportConfiguration $configuration)
 {
     $criteria = $this->getCriteria($configuration);
     $collection = $this->repository->matching($criteria);
     $report = new ReportRowCollection();
     $collection->map(function (OrderInterface $order) use($configuration, $report) {
         $date = $order->getCreatedAt()->format($configuration->getGroupByDateFormat());
         $amount = $this->convertAmount($order);
         $report->add(new ReportRow($date, $amount));
     });
     return $report;
 }