function productLocationAction() { $form = new Form_ProductLocation(); $form->addHidden(); $form->readFields(); $placement = new Model_Placements(); $placement_loc = new Model_PlacementLocations(); $stock_detail = new Model_StockDetail(); $id = $this->_request->getParam("itemid"); $locid = $this->_request->getParam("locid"); $stock_detail_id = $this->_em->getRepository("StockDetail")->find($id); $stock_batch_id = $stock_detail_id->getStockBatch()->getPkId(); $stockbatch = $this->_em->find('StockBatch', $stock_batch_id); $batchnumer = $stockbatch->getPkId(); $batchname = $stockbatch->getNumber(); $item_pack_size = $stockbatch->getItemPackSize()->getPkId(); $item_pack_size_id = $this->_em->find('ItemPackSizes', $item_pack_size); $item_p_id = $item_pack_size_id->getPkId(); $itemname = $item_pack_size_id->getItemName(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $placement->form_values = $form->getValues(); $placement->form_values['stock_detail_id'] = $id; $form->form_values['batchId'] = $batchnumer; $form->form_values['itemId'] = $item_p_id; $placement->addPlacement(); $this->redirect("/stock/product-location?success=1&itemid={$id}&locid={$locid}"); } } $this->view->form = $form; $placement->form_values['id'] = $id; $placement->form_values['locid'] = $locid; $form->item_pack_size_id->setValue($itemname); $form->stock_batch_id->setValue($batchname); $stock_detail->form_values['batchId'] = $stockbatch->getPkId(); $result = $stock_detail->getUnTotalQuantityByBatch($id); $form->unallocated_quantity->setValue($result['unallocated_qty']); $form->total_quantity->setValue($result['product_qty']); $rec = $this->_em->getRepository("PlacementLocations")->findBy(array("locationId" => $locid)); $plc_id = $rec[0]->getPkId(); $result = $placement->getProductPlacements($plc_id, $id); $form->placement_location_id->setValue($plc_id); $form->batchId->setValue($batchnumer); $form->itemId->setValue($item_p_id); $this->view->result = $result; }