/** * Get invoice new product prices. * * @param InjectableFixture $product * @param array $actualPrices * @return array */ public function getInvoiceNewPrices($actualPrices, InjectableFixture $product) { $productBlock = $this->orderInvoiceNew->getFormBlock()->getItemsBlock()->getItemProductBlock($product); $actualPrices['cart_item_price_excl_tax'] = $productBlock->getItemPriceExclTax(); $actualPrices['cart_item_price_incl_tax'] = $productBlock->getItemPriceInclTax(); $actualPrices['cart_item_subtotal_excl_tax'] = $productBlock->getItemSubExclTax(); $actualPrices['cart_item_subtotal_incl_tax'] = $productBlock->getItemSubInclTax(); return $actualPrices; }
/** * Create invoice (with shipment optionally) for order on backend. * * @return array */ public function run() { $this->orderIndex->open(); $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); $this->salesOrderView->getPageActions()->invoice(); if (!empty($this->data)) { $this->orderInvoiceNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); $this->orderInvoiceNew->getFormBlock()->updateQty(); } $this->orderInvoiceNew->getFormBlock()->submit(); $invoiceIds = $this->getInvoiceIds(); if (!empty($this->data)) { $shipmentIds = $this->getShipmentIds(); } return ['invoiceIds' => $invoiceIds, 'shipmentIds' => isset($shipmentIds) ? $shipmentIds : null]; }
/** * Sales coupon report * * @param OrderInjectable $order * @param array $viewsReport * @return void */ public function test(OrderInjectable $order, array $viewsReport) { // Precondition $order->persist(); $this->orderIndex->open(); $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); $this->orderView->getPageActions()->invoice(); $this->orderInvoiceNew->getTotalsBlock()->submit(); $this->reportStatistic->open(); $this->reportStatistic->getGridBlock()->massaction([['report' => 'Coupons']], 'Refresh Statistics for the Last Day', true); // Steps $this->salesCouponReportView->open(); $ruleName = $order->getCouponCode()->getName(); $viewsReport['rules_list'] = str_replace('%rule_name%', $ruleName, $viewsReport['rules_list']); $this->salesCouponReportView->getFilterBlock()->viewsReport($viewsReport); $this->salesCouponReportView->getActionBlock()->showReport(); }