Example #1
0
 public function index(Application $app, Request $request)
 {
     // install.phpのチェック.
     if (isset($app['config']['eccube_install']) && $app['config']['eccube_install'] == 1) {
         $file = $app['config']['root_dir'] . '/html/install.php';
         if (file_exists($file)) {
             $app->addWarning('admin.install.warning', 'admin');
         }
     }
     // 受注マスター検索用フォーム
     $searchOrderForm = $app['form.factory']->createBuilder('admin_search_order')->getForm();
     // 商品マスター検索用フォーム
     $searchProductForm = $app['form.factory']->createBuilder('admin_search_product')->getForm();
     // 会員マスター検索用フォーム
     $searchCustomerForm = $app['form.factory']->createBuilder('admin_search_customer')->getForm();
     /**
      * 受注状況.
      */
     $excludes = array();
     $excludes[] = $app['config']['order_pending'];
     $excludes[] = $app['config']['order_processing'];
     $excludes[] = $app['config']['order_cancel'];
     $excludes[] = $app['config']['order_deliv'];
     // 受注ステータスごとの受注件数.
     $Orders = $this->getOrderEachStatus($app['orm.em'], $excludes);
     // 受注ステータスの一覧.
     $OrderStatuses = $this->findOrderStatus($app['orm.em'], $excludes);
     /**
      * 売り上げ状況
      */
     $excludes = array();
     $excludes[] = $app['config']['order_processing'];
     $excludes[] = $app['config']['order_cancel'];
     $excludes[] = $app['config']['order_pending'];
     // 今日の売上/件数
     $salesToday = $this->getSalesByDay($app['orm.em'], new \DateTime(), $excludes);
     // 昨日の売上/件数
     $salesYesterday = $this->getSalesByDay($app['orm.em'], new \DateTime('-1 day'), $excludes);
     // 今月の売上/件数
     $salesThisMonth = $this->getSalesByMonth($app['orm.em'], new \DateTime(), $excludes);
     /**
      * ショップ状況
      */
     // 在庫切れ商品数
     $countNonStockProducts = $this->countNonStockProducts($app['orm.em']);
     // 本会員数
     $countCustomers = $this->countCustomers($app['orm.em']);
     return $app->render('index.twig', array('searchOrderForm' => $searchOrderForm->createView(), 'searchProductForm' => $searchProductForm->createView(), 'searchCustomerForm' => $searchCustomerForm->createView(), 'Orders' => $Orders, 'OrderStatuses' => $OrderStatuses, 'salesThisMonth' => $salesThisMonth, 'salesToday' => $salesToday, 'salesYesterday' => $salesYesterday, 'countNonStockProducts' => $countNonStockProducts, 'countCustomers' => $countCustomers));
 }
Example #2
0
 public function index(Application $app, Request $request)
 {
     // install.phpのチェック.
     if (isset($app['config']['eccube_install']) && $app['config']['eccube_install'] == 1) {
         $file = $app['config']['root_dir'] . '/html/install.php';
         if (file_exists($file)) {
             $message = $app->trans('admin.install.warning', array('installphpPath' => 'html/install.php'));
             $app->addWarning($message, 'admin');
         }
         $fileOnRoot = $app['config']['root_dir'] . '/install.php';
         if (file_exists($fileOnRoot)) {
             $message = $app->trans('admin.install.warning', array('installphpPath' => 'install.php'));
             $app->addWarning($message, 'admin');
         }
     }
     // 受注マスター検索用フォーム
     $searchOrderBuilder = $app['form.factory']->createBuilder('admin_search_order');
     // 商品マスター検索用フォーム
     $searchProductBuilder = $app['form.factory']->createBuilder('admin_search_product');
     // 会員マスター検索用フォーム
     $searchCustomerBuilder = $app['form.factory']->createBuilder('admin_search_customer');
     $event = new EventArgs(array('searchOrderBuilder' => $searchOrderBuilder, 'searchProductBuilder' => $searchProductBuilder, 'searchCustomerBuilder' => $searchCustomerBuilder), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_INITIALIZE, $event);
     // 受注マスター検索用フォーム
     $searchOrderForm = $searchOrderBuilder->getForm();
     // 商品マスター検索用フォーム
     $searchProductForm = $searchProductBuilder->getForm();
     // 会員マスター検索用フォーム
     $searchCustomerForm = $searchCustomerBuilder->getForm();
     /**
      * 受注状況.
      */
     $excludes = array();
     $excludes[] = $app['config']['order_pending'];
     $excludes[] = $app['config']['order_processing'];
     $excludes[] = $app['config']['order_cancel'];
     $excludes[] = $app['config']['order_deliv'];
     $event = new EventArgs(array('excludes' => $excludes), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_ORDER, $event);
     // 受注ステータスごとの受注件数.
     $Orders = $this->getOrderEachStatus($app['orm.em'], $excludes);
     // 受注ステータスの一覧.
     $OrderStatuses = $this->findOrderStatus($app['orm.em'], $excludes);
     /**
      * 売り上げ状況
      */
     $excludes = array();
     $excludes[] = $app['config']['order_processing'];
     $excludes[] = $app['config']['order_cancel'];
     $excludes[] = $app['config']['order_pending'];
     $event = new EventArgs(array('excludes' => $excludes), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_SALES, $event);
     // 今日の売上/件数
     $salesToday = $this->getSalesByDay($app['orm.em'], new \DateTime(), $excludes);
     // 昨日の売上/件数
     $salesYesterday = $this->getSalesByDay($app['orm.em'], new \DateTime('-1 day'), $excludes);
     // 今月の売上/件数
     $salesThisMonth = $this->getSalesByMonth($app['orm.em'], new \DateTime(), $excludes);
     /**
      * ショップ状況
      */
     // 在庫切れ商品数
     $countNonStockProducts = $this->countNonStockProducts($app['orm.em']);
     // 本会員数
     $countCustomers = $this->countCustomers($app['orm.em']);
     $event = new EventArgs(array('Orders' => $Orders, 'OrderStatuses' => $OrderStatuses, 'salesThisMonth' => $salesThisMonth, 'salesToday' => $salesToday, 'salesYesterday' => $salesYesterday, 'countNonStockProducts' => $countNonStockProducts, 'countCustomers' => $countCustomers), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ADMIM_INDEX_COMPLETE, $event);
     return $app->render('index.twig', array('searchOrderForm' => $searchOrderForm->createView(), 'searchProductForm' => $searchProductForm->createView(), 'searchCustomerForm' => $searchCustomerForm->createView(), 'Orders' => $Orders, 'OrderStatuses' => $OrderStatuses, 'salesThisMonth' => $salesThisMonth, 'salesToday' => $salesToday, 'salesYesterday' => $salesYesterday, 'countNonStockProducts' => $countNonStockProducts, 'countCustomers' => $countCustomers));
 }