public function vvmManagementAction()
 {
     $form = new Form_VvmManagement();
     if ($this->_request->isPost()) {
         $product_id = $this->_request->getPost('product');
         $batch_id = $this->_request->getPost('batch');
         $msg = '';
         $em = Zend_Registry::get('doctrine');
         $em->getConnection()->beginTransaction();
         try {
             $quantity = $this->_request->quantity;
             $newvvm = $this->_request->newvvm;
             foreach ($quantity as $key => $value) {
                 if (!empty($value) && $value > 0) {
                     $updatedqty = $value;
                     list($batchid, $vvmid, $locationid) = explode("_", $key);
                     $batch_detail = $this->_em->getRepository("StockBatch")->find($batchid);
                     $placement = new Model_Placements();
                     $placement->form_values = array('quantity' => "-" . $updatedqty, 'placement_loc_id' => $locationid, 'batch_id' => $batchid, 'placement_loc_type_id' => 116, 'user_id' => $this->_userid, 'created_date' => date("Y-m-d"), 'vvmstage' => $vvmid, 'is_placed' => 0);
                     $placement->add();
                     $placement->form_values = array('quantity' => $updatedqty, 'placement_loc_id' => $locationid, 'batch_id' => $batchid, 'placement_loc_type_id' => 116, 'user_id' => $this->_userid, 'created_date' => date("Y-m-d"), 'vvmstage' => $newvvm[$key], 'is_placed' => 1);
                     $placement->add();
                     //Log Entry START
                     $history = new VvmTransferHistory();
                     $from_to_batch = $this->_em->getRepository("StockBatch")->find($batchid);
                     $history->setBatch($from_to_batch);
                     $from_vvmstages = $this->_em->getRepository("VvmStages")->find($vvmid);
                     $history->setFromVvmStage($from_vvmstages);
                     $to_vvmstages = $this->_em->getRepository("VvmStages")->find($newvvm[$key]);
                     $history->setToVvmStage($to_vvmstages);
                     $created_by = $this->_em->getRepository("Users")->find($this->_userid);
                     $history->setCreatedBy($created_by);
                     $history->setCreatedDate(new DateTime(date("Y-m-d")));
                     $history->setQuantity(ABS($updatedqty));
                     $this->_em->persist($history);
                     $this->_em->flush();
                     //Log Entry END
                     $msg = 'VVM has been changed successfully!';
                     $product_id = $batch_detail->getItemPackSize()->getPkId();
                     $batch_id = $batchid;
                 }
             }
             $location = new Model_Locations();
             $this->view->result = $location->getBatchVvmLocations($batch_id);
             $form->product->setValue($product_id);
             $this->view->batch = $batch_id;
             $em->getConnection()->commit();
         } catch (Exception $e) {
             $em->getConnection()->rollback();
             $em->close();
             App_FileLogger::info($e);
         }
         $stock_detail = new Model_StockDetail();
         $this->view->h_result = $stock_detail->getVvmTransferHistory($product_id);
     }
     $this->view->form = $form;
     $this->view->msg = $msg;
 }