Initial commit: Vendor Sales Report Magento 2 module
This commit is contained in:
78
Block/Adminhtml/Report.php
Normal file
78
Block/Adminhtml/Report.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace Shopkeeper\VendorSalesReport\Block\Adminhtml;
|
||||
|
||||
use Magento\Backend\Block\Template;
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Shopkeeper\VendorSalesReport\Helper\Data as ConfigHelper;
|
||||
|
||||
class Report extends Template
|
||||
{
|
||||
/**
|
||||
* @var ConfigHelper
|
||||
*/
|
||||
protected $configHelper;
|
||||
|
||||
/**
|
||||
* @param Context $context
|
||||
* @param ConfigHelper $configHelper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
ConfigHelper $configHelper,
|
||||
array $data = []
|
||||
) {
|
||||
$this->configHelper = $configHelper;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grid URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGridUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/grid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get export URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExportUrl()
|
||||
{
|
||||
return $this->getUrl('*/*/export');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get configured order statuses
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOrderStatuses()
|
||||
{
|
||||
return $this->configHelper->getOrderStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default start date (first day of last month)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultStartDate()
|
||||
{
|
||||
return date('Y-m-01', strtotime('first day of last month'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default end date (last day of last month)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultEndDate()
|
||||
{
|
||||
return date('Y-m-t', strtotime('last day of last month'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user