public function indexAction() { $this->_form->addAttributesForm($this->view->baseUrl . "/stock/stockview/index", "stockview_form", "post"); $controllerName = $this->getRequest()->getControllerName(); $actionName = $this->getRequest()->getActionName(); $cdwindow = $this->getCdWindow($controllerName, $actionName); $buttonPrint = $this->_form->createButton("Hidden", "Impressões", "prints", $this->view->baseUrl . "/report/report/index/cdwindow/" . $cdwindow, "_self", "print_btn"); $params = array("print_btn" => $buttonPrint); $this->_form->createFormToolbar(null, null, $params, null); $this->_form->addElementsForm(); $this->view->form = $this->_form; $cdsupply = 0; $contSupplyStockInput = 0; $contSupplyStockOutput = 0; $contSupplyQuantity = 0; if (isset($_POST['cdsupply'])) { $array = $_POST; $dateInitialDate = new Zend_Date($array["initialDate"], 'dd-MM-YYYY HH:mm:ss'); $array["initialDate"] = $dateInitialDate->toString('YYYY-MM-dd HH:mm:ss'); $dateFinalDate = new Zend_Date($array["finalDate"], 'dd-MM-YYYY HH:mm:ss'); $array["finalDate"] = $dateFinalDate->toString('YYYY-MM-dd HH:mm:ss'); $supplystockModel = new SupplystockModel(); $supplyModel = new SupplyModel(); $cdsupply = $_POST['cdsupply']; $supplyQuantity = $supplyModel->fetchAll($supplyModel->getAllSupllyQuantityBySupply($cdsupply)); $supplyStockInputSupply = $supplystockModel->fetchAll($supplystockModel->getTotalInputMovimentationFlowBySupply($array)); $supplystockOutputSupply = $supplystockModel->fetchAll($supplystockModel->getTotalOutputMovimentationSupplyStock($array)); foreach ($supplyStockInputSupply as $supplystockinput) { $contSupplyStockInput += $supplystockinput->numberInput; } foreach ($supplystockOutputSupply as $supplystockOutput) { $contSupplyStockOutput += $supplystockOutput->numberOutput; } foreach ($supplyQuantity as $supplystockquantity) { $contSupplyQuantity += $supplystockquantity->qtbalance; } $this->_form->setValues($_POST); $this->_form->addElementsForm(); $this->view->form = $this->_form; if ($contSupplyStockInput == 0 || $contSupplyStockOutput == 0) { $this->addMessage("Nenhuma movimentação realizada neste item durante período selecionado."); $this->_redirect("/message/warning/param_module/stock/param_controller/stockview/param_action/index"); } } $this->view->cdsupply = $cdsupply; $this->view->supplyQuantity = $contSupplyQuantity; $this->view->supplyStockIputSupply = $contSupplyStockInput; $this->view->supplystockOutputSupply = $contSupplyStockOutput; }