示例#1
0
 /**
  * {@inheritdoc}
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _prepareColumns()
 {
     $this->addColumn('period', ['header' => __('Interval'), 'index' => 'period', 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', 'totals_label' => __('Total'), 'html_decorators' => ['nobr'], 'header_css_class' => 'col-period', 'column_css_class' => 'col-period']);
     $this->addColumn('orders_count', ['header' => __('Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-orders', 'column_css_class' => 'col-orders']);
     $this->addColumn('total_qty_ordered', ['header' => __('Sales Items'), 'index' => 'total_qty_ordered', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-sales-items', 'column_css_class' => 'col-sales-items']);
     $this->addColumn('total_qty_invoiced', ['header' => __('Items'), 'index' => 'total_qty_invoiced', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'header_css_class' => 'col-items', 'column_css_class' => 'col-items']);
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $rate = $this->getRate($currencyCode);
     $this->addColumn('total_income_amount', ['header' => __('Sales Total'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_income_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-sales-total', 'column_css_class' => 'col-sales-total']);
     $this->addColumn('total_revenue_amount', ['header' => __('Revenue'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_revenue_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-revenue', 'column_css_class' => 'col-revenue']);
     $this->addColumn('total_profit_amount', ['header' => __('Profit'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_profit_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-profit', 'column_css_class' => 'col-profit']);
     $this->addColumn('total_invoiced_amount', ['header' => __('Invoiced'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_invoiced_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-invoiced', 'column_css_class' => 'col-invoiced']);
     $this->addColumn('total_paid_amount', ['header' => __('Paid'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_paid_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-paid', 'column_css_class' => 'col-paid']);
     $this->addColumn('total_refunded_amount', ['header' => __('Refunded'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_refunded_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-refunded', 'column_css_class' => 'col-refunded']);
     $this->addColumn('total_tax_amount', ['header' => __('Sales Tax'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_tax_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-sales-tax', 'column_css_class' => 'col-sales-tax']);
     $this->addColumn('total_tax_amount_actual', ['header' => __('Tax'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_tax_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-tax', 'column_css_class' => 'col-tax']);
     $this->addColumn('total_shipping_amount', ['header' => __('Sales Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-sales-shipping', 'column_css_class' => 'col-sales-shipping']);
     $this->addColumn('total_shipping_amount_actual', ['header' => __('Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-shipping', 'column_css_class' => 'col-shipping']);
     $this->addColumn('total_discount_amount', ['header' => __('Sales Discount'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_discount_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-sales-discount', 'column_css_class' => 'col-sales-discount']);
     $this->addColumn('total_discount_amount_actual', ['header' => __('Discount'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_discount_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => ['show_actual_columns'], 'rate' => $rate, 'header_css_class' => 'col-discount', 'column_css_class' => 'col-discount']);
     $this->addColumn('total_canceled_amount', ['header' => __('Canceled'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_canceled_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-canceled', 'column_css_class' => 'col-canceled']);
     $this->addExportType('*/*/exportSalesCsv', __('CSV'));
     $this->addExportType('*/*/exportSalesExcel', __('Excel XML'));
     return parent::_prepareColumns();
 }
示例#2
0
 /**
  * Add price rule filter
  *
  * @param \Magento\Reports\Model\Resource\Report\Collection\AbstractCollection $collection
  * @param \Magento\Framework\Object $filterData
  * @return \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid
  */
 protected function _addCustomFilter($collection, $filterData)
 {
     if ($filterData->getPriceRuleType()) {
         $rulesList = $filterData->getData('rules_list');
         if (isset($rulesList[0])) {
             $rulesIds = explode(',', $rulesList[0]);
             $collection->addRuleFilter($rulesIds);
         }
     }
     return parent::_addCustomFilter($filterData, $collection);
 }
示例#3
0
文件: Grid.php 项目: aiesh/magento2
 /**
  * @return \Magento\Backend\Block\Widget\Grid\Extended
  */
 protected function _prepareColumns()
 {
     $this->addColumn('period', array('header' => __('Interval'), 'index' => 'period', 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', 'totals_label' => __('Total'), 'html_decorators' => array('nobr'), 'header_css_class' => 'col-period', 'column_css_class' => 'col-period'));
     $this->addColumn('product_name', array('header' => __('Product'), 'index' => 'product_name', 'type' => 'string', 'sortable' => false, 'header_css_class' => 'col-product', 'column_css_class' => 'col-product'));
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $this->addColumn('product_price', array('header' => __('Price'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'product_price', 'sortable' => false, 'rate' => $this->getRate($currencyCode), 'header_css_class' => 'col-price', 'column_css_class' => 'col-price'));
     $this->addColumn('qty_ordered', array('header' => __('Order Quantity'), 'index' => 'qty_ordered', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-qty', 'column_css_class' => 'col-qty'));
     $this->addExportType('*/*/exportBestsellersCsv', __('CSV'));
     $this->addExportType('*/*/exportBestsellersExcel', __('Excel XML'));
     return parent::_prepareColumns();
 }
示例#4
0
文件: Grid.php 项目: nja78/magento2
 /**
  * {@inheritdoc}
  */
 protected function _prepareColumns()
 {
     $this->addColumn('period', ['header' => __('Interval'), 'index' => 'period', 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', 'totals_label' => __('Total'), 'subtotals_label' => __('Subtotal'), 'html_decorators' => ['nobr'], 'header_css_class' => 'col-period', 'column_css_class' => 'col-period']);
     $this->addColumn('shipping_description', ['header' => __('Carrier/Method'), 'index' => 'shipping_description', 'sortable' => false, 'header_css_class' => 'col-method', 'column_css_class' => 'col-method']);
     $this->addColumn('orders_count', ['header' => __('Orders'), 'index' => 'orders_count', 'total' => 'sum', 'type' => 'number', 'sortable' => false, 'header_css_class' => 'col-qty', 'column_css_class' => 'col-qty']);
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $rate = $this->getRate($currencyCode);
     $this->addColumn('total_shipping', ['header' => __('Total Sales Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-total-sales-shipping', 'column_css_class' => 'col-total-sales-shipping']);
     $this->addColumn('total_shipping_actual', ['header' => __('Total Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping_actual', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-total-shipping', 'column_css_class' => 'col-total-shipping']);
     $this->addExportType('*/*/exportShippingCsv', __('CSV'));
     $this->addExportType('*/*/exportShippingExcel', __('Excel XML'));
     return parent::_prepareColumns();
 }
示例#5
0
 /**
  * {@inheritdoc}
  */
 protected function _prepareColumns()
 {
     $this->addColumn('period', ['header' => __('Interval'), 'index' => 'period', 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', 'totals_label' => __('Total'), 'html_decorators' => ['nobr'], 'header_css_class' => 'col-period', 'column_css_class' => 'col-period']);
     $this->addColumn('orders_count', ['header' => __('Refunded Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-qty', 'column_css_class' => 'col-qty']);
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $rate = $this->getRate($currencyCode);
     $this->addColumn('refunded', ['header' => __('Total Refunded'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'refunded', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-ref-total', 'column_css_class' => 'col-ref-total']);
     $this->addColumn('online_refunded', ['header' => __('Online Refunds'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'online_refunded', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-ref-online', 'column_css_class' => 'col-ref-online']);
     $this->addColumn('offline_refunded', ['header' => __('Offline Refunds'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'offline_refunded', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-ref-offline', 'column_css_class' => 'col-ref-offline']);
     $this->addExportType('*/*/exportRefundedCsv', __('CSV'));
     $this->addExportType('*/*/exportRefundedExcel', __('Excel XML'));
     return parent::_prepareColumns();
 }
示例#6
0
文件: Grid.php 项目: aiesh/magento2
 /**
  * @return \Magento\Backend\Block\Widget\Grid\Extended
  */
 protected function _prepareColumns()
 {
     $this->addColumn('period', array('header' => __('Interval'), 'index' => 'period', 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'Magento\\Reports\\Block\\Adminhtml\\Sales\\Grid\\Column\\Renderer\\Date', 'totals_label' => __('Total'), 'html_decorators' => array('nobr'), 'header_css_class' => 'col-period', 'column_css_class' => 'col-period'));
     $this->addColumn('orders_count', array('header' => __('Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-qty', 'column_css_class' => 'col-qty'));
     $this->addColumn('orders_invoiced', array('header' => __('Invoiced Orders'), 'index' => 'orders_invoiced', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'header_css_class' => 'col-invoiced', 'column_css_class' => 'col-invoiced'));
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $rate = $this->getRate($currencyCode);
     $this->addColumn('invoiced', array('header' => __('Total Invoiced'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'invoiced', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-total-invoiced', 'column_css_class' => 'col-total-invoiced'));
     $this->addColumn('invoiced_captured', array('header' => __('Paid Invoices'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'invoiced_captured', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-total-invoiced-paid', 'column_css_class' => 'col-total-invoiced-paid'));
     $this->addColumn('invoiced_not_captured', array('header' => __('Unpaid Invoices'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'invoiced_not_captured', 'total' => 'sum', 'sortable' => false, 'rate' => $rate, 'header_css_class' => 'col-total-invoiced-not-paid', 'column_css_class' => 'col-total-invoiced-not-paid'));
     $this->addExportType('*/*/exportInvoicedCsv', __('CSV'));
     $this->addExportType('*/*/exportInvoicedExcel', __('Excel XML'));
     return parent::_prepareColumns();
 }
示例#7
0
 /**
  * Preparing collection.  Filter canceled statuses for orders in taxes
  *
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _prepareCollection()
 {
     $filterData = $this->getFilterData();
     if (!$filterData->hasData('order_statuses')) {
         $orderConfig = $this->_configFactory->create();
         $statusValues = [];
         $canceledStatuses = $orderConfig->getStateStatuses(\Magento\Sales\Model\Order::STATE_CANCELED);
         foreach ($orderConfig->getStatuses() as $code => $label) {
             if (!isset($canceledStatuses[$code])) {
                 $statusValues[] = $code;
             }
         }
         $filterData->setOrderStatuses($statusValues);
     }
     return parent::_prepareCollection();
 }