public function detailsAction() { $container = new Container('output_inventory'); $viewModel = new ViewModel(); if (!$container->id) { return $this->redirect()->toRoute('process/output_inventory'); } $outputInventoryId = $container->id; $user = $container->user; $outputInventory = $this->getOutputInventoryTable()->get($outputInventoryId, $user); $form = new DetailsOutputInventoryForm(); $detailsOutputInventory = new DetailsOutputInventory(); $form->setInputFilter($detailsOutputInventory->getInputFilter()); $request = $this->getRequest(); $data = $request->getPost()->toArray(); $form->setData($data); if ($request->isPost()) { if ($form->isValid()) { $data['output_inventory'] = $outputInventoryId; $data['serial'] = $data['product']; $data['cost'] = str_replace('.', '', $data['cost']); $productsReceiveInventory = $this->getProductsReceiveInventoryTable()->getBySerial($data['serial']); $detailsReceiveInventory = $productsReceiveInventory->getDetailsReceiveInventory(); $number = $productsReceiveInventory->getNumber(); $product = $productsReceiveInventory->getProduct(); $data['product'] = $product; $this->getProductsReceiveInventoryTable()->update($detailsReceiveInventory, $number); $detailsOutputInventory->exchangeArray($data); $this->getDetailsOutputInventoryTable()->save($detailsOutputInventory); return $this->redirect()->toRoute('process/output_inventory/add/details'); } } $detailsOutputInventory = $this->getDetailsOutputInventoryTable()->get($container->id); $viewModel->setVariable('form', $form); $viewModel->setVariable('outputInventory', $outputInventory); $viewModel->setVariable('config', $this->config); $viewModel->setVariable('detailsOutputInventory', $detailsOutputInventory); $viewModel->setTemplate("process/output-inventory/details"); return $viewModel; }