示例#1
0
 public function view()
 {
     $sr = new SalesReport();
     $this->set('sr', $sr);
     $pkg = Package::getByHandle('vivid_store');
     $packagePath = $pkg->getRelativePath();
     $this->requireAsset('chartist');
     $today = date('Y-m-d');
     $thirtyDaysAgo = date('Y-m-d', strtotime('-30 days'));
     $this->set('defaultFromDate', $thirtyDaysAgo);
     $this->set('defaultToDate', $today);
     $dateFrom = $this->post('dateFrom');
     $dateTo = $this->post('dateTo');
     if (!$dateFrom) {
         $dateFrom = $thirtyDaysAgo;
     }
     if (!$dateTo) {
         $dateTo = $today;
     }
     $this->set('dateFrom', $dateFrom);
     $this->set('dateTo', $dateTo);
     $ordersTotals = $sr::getTotalsByRange($dateFrom, $dateTo);
     $this->set('ordersTotals', $ordersTotals);
     $orders = new OrderList();
     $orders->setFromDate($dateFrom);
     $orders->setToDate($dateTo);
     $orders->setItemsPerPage(10);
     $paginator = $orders->getPagination();
     $pagination = $paginator->renderDefaultView();
     $this->set('orders', $paginator->getCurrentPageResults());
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
     $this->addHeaderItem(Core::make('helper/html')->css($packagePath . '/css/vividStoreDashboard.css'));
 }
示例#2
0
 public function setOrderItemsByRange($from = null, $to = null)
 {
     if (!isset($from)) {
         $from = OrderList::getDateOfFirstOrder();
     }
     if (!$to) {
         $to = date('Y-m-d');
     }
     $orders = new OrderList();
     $orders->setFromDate($from);
     $orders->setToDate($to);
     $this->orderItems = $orders->getOrderItems();
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->setFromDate();
     $this->setToDate();
     $this->setLimit(0);
 }
示例#4
0
 public function view()
 {
     $dateFrom = $this->post('dateFrom');
     $dateTo = $this->post('dateTo');
     if (!$dateFrom) {
         $dateFrom = OrderList::getDateOfFirstOrder();
     }
     if (!$dateTo) {
         $dateTo = date('Y-m-d');
     }
     $pr = new ProductReport($dateFrom, $dateTo);
     $orderBy = $this->post('orderBy');
     if (!$orderBy) {
         $orderBy = 'quantity';
     }
     if ($orderBy == 'quantity') {
         $pr->sortByPopularity();
     } else {
         $pr->sortByTotal();
     }
     //$products = $pr->getProducts();
     $this->set('dateFrom', $dateFrom);
     $this->set('dateTo', $dateTo);
     $pr->setItemsPerPage(10);
     $paginator = $pr->getPagination();
     $pagination = $paginator->renderDefaultView();
     $this->set('products', $paginator->getCurrentPageResults());
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
 }
示例#5
0
 public function view($status = '')
 {
     $orderList = new OrderList();
     if ($this->get('keywords')) {
         $orderList->setSearch($this->get('keywords'));
     }
     if ($status) {
         $orderList->setStatus($status);
     }
     $orderList->setItemsPerPage(20);
     $paginator = $orderList->getPagination();
     $pagination = $paginator->renderDefaultView();
     $this->set('orderList', $paginator->getCurrentPageResults());
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
     $this->set('orderStatuses', OrderStatus::getList());
     $this->requireAsset('css', 'vividStoreDashboard');
     $this->requireAsset('javascript', 'vividStoreFunctions');
     $this->set('statuses', OrderStatus::getAll());
 }
示例#6
0
 public function view($status = '')
 {
     $orderList = new OrderList();
     if ($this->get('keywords')) {
         $orderList->setSearch($this->get('keywords'));
     }
     if ($status) {
         $orderList->setStatus($status);
     }
     $orderList->setItemsPerPage(20);
     $paginator = $orderList->getPagination();
     $pagination = $paginator->renderDefaultView();
     $this->set('orderList', $paginator->getCurrentPageResults());
     $this->set('pagination', $pagination);
     $this->set('paginator', $paginator);
     $this->set('orderStatuses', OrderStatus::getList());
     $pkg = Package::getByHandle('vivid_store');
     $packagePath = $pkg->getRelativePath();
     $this->addHeaderItem(Core::make('helper/html')->css($packagePath . '/css/vividStoreDashboard.css'));
     $this->addFooterItem(Core::make('helper/html')->javascript($packagePath . '/js/vividStoreFunctions.js'));
     $this->set('statuses', OrderStatus::getAll());
 }