public function indexAction()
 {
     $centerCompanyModel = new CompanyModel();
     $physicallocationModel = new PhysicallocationModel();
     $physicallocationData = $physicallocationModel->fetchAll();
     $this->view->physicallocationData = $physicallocationData;
     $centerDadosArray = $centerCompanyModel->fetchAll();
     $this->view->centerDadosArray = $centerDadosArray;
     $controllerName = $this->getRequest()->getControllerName();
     $actionName = $this->getRequest()->getActionName();
     $cdwindow = $this->getCdWindow($controllerName, $actionName);
     $_SESSION['cdwindow'] = $cdwindow;
 }
Beispiel #2
0
 public function __construct()
 {
     parent::__construct();
     $physicallocationModel = new PhysicallocationModel();
     $physicallocationData = $physicallocationModel->fetchAll();
     $physicallocationArray = $physicallocationData;
     $centerModel = new CompanyModel();
     $centerDadosArray = $centerModel->fetchAll();
     $this->_cdsupplycentre = new Zend_Form_Element_Text('cdsupplycentre');
     $this->_cdsupplycentre->setLabel("Código");
     $this->_cdsupplycentre->setDecorators($this->_decoratorsDefault);
     $this->_cdsupplycentre->setAttrib("id", "center_cdsupplycentre");
     $this->_cdsupplycentre->setRequired(false);
     $this->_idsupplycentre = new Zend_Form_Element_Text('idsupplycentre');
     $this->_idsupplycentre->setLabel("Nome");
     $this->_idsupplycentre->setDecorators($this->_decoratorsDefault);
     $this->_idsupplycentre->setAttrib("id", "center_idsupplycentre");
     $this->_idsupplycentre->setRequired(false);
     $this->_fgsupplycentretype = new Zend_Form_Element_Select('fgsupplycentretype');
     $this->_fgsupplycentretype->setLabel("Tipo");
     $this->_fgsupplycentretype->addMultiOptions(array("" => "Selecione", "1" => "Consumo", "2" => "Empréstimo", "3" => "Devolução", "4" => "Estocagem", "5" => "Descarte"));
     $this->_fgsupplycentretype->setDecorators($this->_decoratorsDefault);
     $this->_fgsupplycentretype->setRequired(false);
     $this->_fgsupplycentretype->setAttrib("id", "center_fgsupplycentretype");
     $this->_cdcompany = new Zend_Form_Element_Select('cdcompany');
     $this->_cdcompany->setLabel("Unidade");
     $this->_cdcompany->addMultiOption("", "Selecione");
     foreach ($centerDadosArray as $centerDado) {
         $this->_cdcompany->addMultiOption($centerDado->cdcompany, $centerDado->nmcompany);
     }
     $this->_cdcompany->setAttrib("id", "center_cdcompany");
     $this->_cdcompany->setDecorators($this->_decoratorsDefault);
     $this->_cdcompany->setRequired(false);
     $this->_cdphysicallocation = new Zend_Form_Element_Select('cdphysicallocation');
     $this->_cdphysicallocation->setLabel("Localização Física");
     $this->_cdphysicallocation->addMultiOption("", "Selecione");
     foreach ($physicallocationArray as $arrayphysicallocation) {
         $this->_cdphysicallocation->addMultiOption($arrayphysicallocation->cdphysicallocation, $arrayphysicallocation->nmphysicallocation);
     }
     $this->_cdphysicallocation->setDecorators($this->_decoratorsRequired);
     $this->_cdphysicallocation->setAttrib("id", "center_cdphysicallocation");
     $this->_cdphysicallocation->setAttrib("class", "alpha");
     $this->_cdphysicallocation->setRequired(false);
 }
 public function dadosAction()
 {
     $this->_helper->layout->disableLayout();
     $page = $this->_request->getParam("page", 1);
     $limit = $this->_request->getParam("rows");
     $sidx = $this->_request->getParam("sidx", 1);
     $sord = $this->_request->getParam("sord");
     $departmentModel = new DepartmentModel();
     $cdphysicallocation = $this->_request->getParam("cdphysicallocation");
     $physicallocationModel = new PhysicallocationModel();
     $physicallocationData = $physicallocationModel->fetchAll();
     $count = count($physicallocationData);
     if ($count > 0 && $limit != 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     if (isset($cdphysicallocation) && $cdphysicallocation != '-1') {
         $physicallocationData = $physicallocationModel->getColorParentPhysicallocation($cdphysicallocation);
         $_SESSION['nmphysicallocation'] = $physicallocationData->nmphysicallocation;
         $_SESSION['nmcolor'] = $physicallocationData->nmcolor;
         $_SESSION['cddphysicallocation'] = $physicallocationData->cdphysicallocation;
         $physicallocationData = $physicallocationModel->fetchAll("cdphysicallocationparent=" . $cdphysicallocation, "{$sidx} {$sord}", $limit, $page * $limit - $limit);
     } else {
         $physicallocationData = $physicallocationModel->fetchAll(null, "{$sidx} {$sord}", $limit, $page * $limit - $limit);
     }
     $responce = new stdClass();
     $responce->page = $page;
     $responce->total = $total_pages;
     $responce->records = $count;
     $i = 0;
     foreach ($physicallocationData as $row) {
         $nmcomapanyparent = '';
         if ($row->cdphysicallocationparent != '') {
             $nmcomapanyparent = $physicallocationModel->getNmparentLocation($row->cdphysicallocationparent);
             $nmcomapanyparent = $nmcomapanyparent->nmphysicallocation;
         } else {
             $nmcomapanyparent = '';
         }
         switch ($row->fgactive) {
             case 1:
                 $fgactive = 'Ativo';
                 break;
             case 2:
                 $fgactive = 'Inativo';
                 break;
         }
         $responce->rows[$i]['cell'] = array('', $row->nmcolor, $row->cdphysicallocation, $row->nmphysicallocation, $fgactive, $nmcomapanyparent);
         $i++;
     }
     $this->view->dados = $responce;
 }