Esempio n. 1
0
 public function convertToArray($datas, $store = SUB_STORE)
 {
     $return = array();
     foreach ($datas as $data) {
         $storeInfo = Utility::getStoreInfo($data->getMenuStoreId());
         if ($store == MAIN_STORE) {
             $storeInfo = Utility::getMainStoreInfo($data->getMenuStoreId());
         }
         $note = TransactionUtility::getStoreItemInOrder($data->getNote());
         if ($note == '') {
             $note = $data->getNote();
         }
         $supplier = Utility::getSupplierInfo($data->getSupplier());
         $array = array();
         $array['id'] = $data->getId();
         $array['menuStoreId'] = $storeInfo->getName();
         $array['action'] = $data->getAction();
         $array['quantity'] = $data->getQuantity();
         $array['unit'] = $data->getUnit();
         $array['date'] = date('d-m-Y', $data->getDate());
         $array['note'] = $note;
         $array['cost'] = $data->getCost();
         $array['supplier'] = $supplier->getCompanyName();
         $return[] = $array;
     }
     return $return;
 }
 public function managerInOutAction()
 {
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number'), array('title' => 'Store Name', 'db' => 'menuStoreId', 'dt' => 1, 'select' => 'menuStoreId', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         $storeInfo = Utility::getMainStoreInfo($d);
         return $storeInfo->getName();
     }), array('title' => 'Action', 'db' => 'action', 'dt' => 2, 'select' => 'action', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Quantity', 'db' => 'quantity', 'dt' => 3, 'select' => 'quantity', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Cost', 'db' => 'cost', 'dt' => 4, 'select' => 'cost', 'prefix' => 'o', 'search' => true, 'type' => 'text'), array('title' => 'Note', 'db' => 'note', 'dt' => 5, 'select' => 'note', 'prefix' => 'o', 'search' => true, 'type' => 'text', 'formatter' => function ($d, $row) {
         $note = TransactionUtility::getStoreItemInOrder($d);
         if ($note == '') {
             $note = $d;
         }
         return $note;
     }), array('title' => 'Action', 'db' => 'orderId', 'dt' => 6, 'select' => 'id', 'prefix' => 'o', 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/menustoremain';
         return '
                     <a class="btn-xs action action-detail btn btn-info btn-default" href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-info-sign"></i></a>
                     <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/add/' . $d . '"><i class="icon-edit"></i></a>
                     <a data-id="' . $d . '" id="' . $d . '" data-link="' . $actionUrl . '" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                 ';
     }));
     /////end column for table
     $table = new AjaxTable(array(), array(), 'admin/menustoremain/managerinout');
     $table->setTableColumns($columns);
     $table->setTablePrefix('o');
     $table->setAjaxCall('/admin/menustoremain/managerinout');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->transactionModel);
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Import/Export')));
 }