public function updateStockPlacement($data, $placement_type)
 {
     // batch_id|placement_loc_id|vvm_stage_id|qty, batch_id|placement_loc_id|vvm_stage_id|qty,batch_id|placement_loc_id|vvm_stage_id|qty
     $placement_info = explode(",", $data);
     App_Controller_Functions::pr($data);
     // Get each placement batch, location,vvm stage and qty.
     foreach ($placement_info as $info) {
         $ids = explode("|", $info);
         // batch_id|placement_loc_id|vvm_stage_id|qty
         // get stock batch
         $stock_batch = $this->_em->getRepository("StockBatchWarehouses")->find($ids['0']);
         // get placement location
         $placement_location = $this->_em->getRepository("PlacementLocations")->find($ids['1']);
         // Get transaction type i.e stock picking.
         $plc_transaction_type = $this->_em->find("ListDetail", $placement_type);
         // Get user id.
         $user_id = $this->_em->find("Users", $this->_user_id);
         $placement = new Placements();
         $placement->setPlacementLocation($placement_location);
         $placement->setStockBatchWarehouse($stock_batch);
         $placement->setPlacementTransactionType($plc_transaction_type);
         $placement->setCreatedBy($user_id);
         $placement->setCreatedDate(App_Tools_Time::now());
         $placement->setModifiedBy($user_id);
         $placement->setModifiedDate(App_Tools_Time::now());
         $vvms = $this->_em->getRepository("VvmStages")->find($ids['2']);
         $placement->setVvmStage($vvms);
         // get qty
         if ($placement_type == Model_PlacementLocations::PLACEMENT_TRANSACTION_TYPE_P) {
             $qty = $ids['3'];
         } elseif ($placement_type == Model_PlacementLocations::PLACEMENT_TRANSACTION_TYPE_PICK) {
             $qty = -1 * $ids['3'];
         }
         $placement->setQuantity($qty);
         $this->_em->persist($placement);
     }
     $this->_em->flush();
     return true;
 }