Exemplo n.º 1
0
 /**
  * Creates and processes the inventory expense form
  */
 public function inventoryexpenseform($newItemMode = null)
 {
     $this->view->addCss('expense/inventoryexpenseform.css');
     $this->view->addJs('jquery.validate.min.js');
     $itemTypes = array();
     $categories = array();
     if ($this->input->post() != null) {
         $data = $this->input->post();
         Debug::log($data);
         try {
             $itemExpenseService = new ItemExpenseService();
             $itemExpenseService->processItemExpenseForm($data);
         } catch (Exception $e) {
             Debug::log($e->getMessage(), 'error');
             $this->_showErrorMessageAndRedirect($e->getMessage());
         }
         $this->_showMessageAndRedirect();
     } else {
         $itemTypeService = new ItemTypeService();
         $itemTypes = $itemTypeService->fetchAllItems();
         $categoryService = new CategoryService();
         $categories = $categoryService->fetchAll();
     }
     $this->renderView('inventoryexpenseform', array('itemTypes' => $itemTypes, 'categories' => $categories, 'newItemMode' => $newItemMode));
 }
Exemplo n.º 2
0
 public function delete()
 {
     $itemTypeIds = $this->input->post('itemTypeIds');
     $itemTypeService = new ItemTypeService();
     $itemTypeService->delete($itemTypeIds);
 }