private function getFormData($cdrequest = "0")
 {
     $gslabSession = Zend_Session::namespaceGet('Gslab_Session');
     /* Usado para a edição de uma requisição
              * Remover quando criar a tela de controle de requisição
              * Maikon.Deletar
              * 
               if($cdrequest > 0)
               {
               $requestModel = new RequestModel();
               $requestData = $requestModel->fetchRow($requestModel->getRequestByCdRequest($cdrequest));
               $this->view->cdrequest = $requestData->cdrequest;
               $this->view->cdclient = $requestData->cdclient;
               $this->view->cdcovenant = $requestData->cdcovenant;
               $this->view->cdforward = $requestData->cdforward;
               $this->view->idcovenantcard = $requestData->idcovenantcard;
               $this->view->fgpriority = $requestData->fgpriority;
               //$this->view->fgcollection = $requestData->fgcollection;
               // Completar aqui com as novas colunas da tabela 'request'
     
               // Tratar variável de data vinda do banco para colocar no formulário
               $dtrequestdb = $requestData->dtrequest;
               $date = new Zend_Date($dtrequestdb, 'YYYY-MM-dd HH:mm:ss');
               $dtrequest = $date->toString('dd-MM-YYYY');
               $hrrequest = $date->toString('HH:mm:ss');
               $this->view->dtrequest = $dtrequest;
               $this->view->hrrequest = $hrrequest;
     
               //die("feshow, cdrequest: " . $cdrequest .", cdclient: ". $requestData->cdclient .", dtbirth: ". $requestData->dtbirth .", nrage: ". $this->view->nrage);
               }
              */
     // Busca todos os Clientes/Pacientes, Ativos e Inativos.
     $clientModel = new ClientModel();
     $this->view->clientData = $clientModel->fetchAll(null, 'client.nmclient');
     // Busca os Guichês ativos e relacionados ao posto de coleta .
     $cashdeskModel = new CashdeskModel();
     $cdcompany = $gslabSession['user']->cdcompany;
     $this->view->cashdeskData = $cashdeskModel->fetchAll("cashdesk.cdcompany = {$cdcompany} AND cashdesk.fgactive = 1", 'cashdesk.nmcashdesk');
     // Busca todas as empresas, Ativas e Inativas.
     $companyModel = new CompanyModel();
     $this->view->companyData = $companyModel->fetchAll('company.cdcompany = ' . $gslabSession['user']->cdcompany . ' OR company.cdcompanyparent = ' . $gslabSession['user']->cdcompany, 'company.nmcompany');
     // Busca todos os médicos que enviaram o paciente
     $forwardModel = new ForwardModel();
     $this->view->forwardData = $forwardModel->fetchAll(null, 'forward.nmforward');
     // Busca apenas Exames Ativos(fgactive = 1)
     $opernatureModel = new OpernatureModel();
     $this->view->opernature = $opernatureModel->fetchAll();
     // Busca apenas suprimentos Ativos(fgactive = 1)
     $supplyModel = new SupplyModel();
     $this->view->supplyData = $supplyModel->fetchAll('supply.fgactive = 1', 'supply.nmsupply');
     // Busca todos os Logradouros.
     $addressTypeModel = new AddresstypeModel();
     $this->view->addressTypeData = $addressTypeModel->getAllAddressType();
     $medicinesModel = new MedicineModel();
     $this->view->medicineData = $medicinesModel->fetchAll("cdsupply IS NOT NULL", 'medicine.nmmedicine');
     $cashdeskModel = new CashdeskModel();
     $this->view->cashdeskData = $cashdeskModel->fetchAll(null, 'cashdesk.nmcashdesk');
 }
Exemplo n.º 2
0
 public function editAction()
 {
     $cdclient = $this->_request->getParam("cdclient");
     $addressTypeModel = new AddresstypeModel();
     $this->view->addressTypeData = $addressTypeModel->getAllAddressType();
     $clientModel = new ClientModel();
     $clientadressModel = new ClientaddressModel();
     $clientphoneModel = new ClientphonenumberModel();
     $clientaddressData = $clientadressModel->fetchRow();
     $client = $clientModel->fetchRow('cdclient = ' . $cdclient);
     $this->view->client = $client;
     $age = $this->view->client->dtbirth;
     $data = new Zend_Date($this->view->client->dtbirth, "YYYY-MM-dd HH:mm:ss");
     $this->view->client->dtbirth = $data->toString('dd-MM-YYYY');
     $this->view->nrage = GslabUtils::calcAgeDifferenceShort($age);
     $this->view->address = $clientadressModel->fetchRow($clientadressModel->getStateById($clientaddressData['idstate'], $cdclient));
     $clientphoneData = $clientphoneModel->fetchRow('cdclient = ' . $cdclient);
     $this->view->phone = $clientphoneData;
     if ($client['dtdum'] != '') {
         $client['dtdum'] = new Zend_Date($this->view->client->dtdum, "YYYY-MM-dd HH:mm:ss");
         $this->view->dtdum = $client['dtdum']->toString('dd-MM-YYYY');
     } else {
         $this->view->dtdum = '';
     }
     if ($clientphoneData['cdclientphonenumber'] != '') {
         $cdclientphonenumber = $clientphoneData['cdclientphonenumber'];
         if ($clientphoneData['nrphonenumber'] != '') {
             $phonenumber = $clientphoneData['nrphonenumber'];
             $dddphonenumber = $clientphoneData['nrdddphone'];
         } else {
             $phonenumber = '';
             $dddphonenumber = '';
         }
         if ($clientphoneData['nrcellphonenumber'] != '') {
             $cellphonenumber = $clientphoneData['nrcellphonenumber'];
             $dddcellphonenumber = $clientphoneData['nrdddcellphone'];
         } else {
             $cellphonenumber = '';
             $dddcellphonenumber = '';
         }
     } else {
         $phonenumber = '';
         $dddphonenumber = '';
         $cdclientphonenumber = '';
         $cellphonenumber = '';
         $dddcellphonenumber = '';
     }
     $this->view->nrphonenumber = $phonenumber;
     $this->view->nrcellphonenumber = $cellphonenumber;
     $this->view->nrdddphone = $dddphonenumber;
     $this->view->nrdddcellphone = $dddcellphonenumber;
     $this->view->cdclientphonenumber = $cdclientphonenumber;
 }