public function receiveWarehouseAction() { $stock_master = new Model_StockMaster(); $form = new Form_ReceiveWarehouse(); $save = false; $em = Zend_Registry::get('doctrine'); $em->getConnection()->beginTransaction(); try { if ($this->_request->isPost()) { $data = $this->_request->getPost(); $issue_no = $data['issue_no']; // App_Controller_Functions::pr($data); $stock_master = new Model_StockMaster(); $stock_master->form_values = $data; $stock_master->addStockWarehouseByIssue(); $em->getConnection()->commit(); $save = true; } else { if (isset($this->_request->search) && !empty($this->_request->search)) { if (isset($this->_request->issue_no) && !empty($this->_request->issue_no)) { $issue_no = $this->_request->issue_no; $stock_master->transaction_number = $issue_no; $stock_master->to_warehouse_id = $this->_identity->getWarehouseId(); $stock_batch = new Model_StockBatch(); $placement_locations = $stock_batch->getAllColdStores(); $non_ccm_loc = new Model_NonCcmLocations(); $non_ccm_locations = $non_ccm_loc->getAllDryStores(); $stockReceive = $stock_master->getwarehouseStockByIssueNo(); $transaction_type = new Model_TransactionTypes(); $trans_type = $transaction_type->findAll(); $count_o = count($stockReceive); $this->view->count = $count_o; $this->view->form = $form; $this->view->result = $stockReceive; $this->view->issue_no = $issue_no; $this->view->trans_type = $trans_type; $this->view->locations = $placement_locations; $this->view->non_ccm_locations = $non_ccm_locations; $form->issue_no->setValue($issue_no); } $em->getConnection()->commit(); } } } catch (Exception $e) { $em->getConnection()->rollback(); $em->close(); App_FileLogger::info($e); } if ($save) { $this->_redirect("stock/receive-warehouse?msg=Received sucessfully!"); } $this->view->form = $form; $is_scanner_enable = $this->_identity->getIsScannerEnable(); if ($is_scanner_enable == 'yes') { $this->render("receive-warehouse-scanner"); } }