public function __construct()
 {
     parent::__construct();
     $cashdeskModel = new CashdeskModel();
     $selectCashDesk = $cashdeskModel->fetchAll();
     $arraycashdesk = array();
     $arraycashdesk['0'] = "Selecione";
     foreach ($selectCashDesk as $selCD) {
         $arraycashdesk[$selCD->cdcashdesk] = $selCD->nmcashdesk;
     }
     $arraypayment = array();
     $arraypayment['0'] = "Selecione";
     $arraypayment['1'] = "Dinheiro";
     $arraypayment['2'] = "Cheque";
     $arraypayment['3'] = "Cheque Pré-datado";
     $arraypayment['4'] = "Cartão de Crédito";
     $arraypayment['5'] = "Cartão de Débito";
     $userInfo = Zend_Auth::getInstance()->getStorage()->read();
     //Aba Localizar Requisição
     $this->_cdrequest = new Zend_Form_Element_Text('cdrequest');
     $this->_cdrequest->setAttrib("id", "appraisaldelivery_cdrequest");
     $this->_cdrequest->setAttrib("onfocus", "limpacampo();");
     $this->_cdrequest->setLabel("Cód. Req.");
     $this->_cdrequest->setDecorators($this->_decoratorsDefault);
     $this->_cdrequest->setRequired(true);
     $this->_nmpacient = new Zend_Form_Element_Text('nmpacient');
     $this->_nmpacient->setAttrib("id", "appraisaldelivery_nmpacient");
     $this->_nmpacient->setAttrib("autocomplete", "off");
     $this->_nmpacient->setAttrib("onfocus", "limpacampo2();");
     $this->_nmpacient->setAttrib("size", "50");
     $this->_nmpacient->setLabel("Nome do Paciente");
     $this->_nmpacient->setDecorators($this->_decoratorsDefault);
     $this->_nmpacient->setRequired(false);
     $this->_nmpacientid = new Zend_Form_Element_Hidden('nmpacientid');
     $this->_nmpacientid->setAttrib("id", "client_cdclient");
     $this->_nmpacientid->setAttrib("onblur", "fill();");
     $this->_nmpacientid->setDecorators($this->_decoratorsDefault);
     $this->_age = new Zend_Form_Element_Text('age');
     $this->_age->setAttrib("id", "appraisaldelivery_age");
     $this->_age->setLabel("Idade");
     $this->_age->setDecorators($this->_decoratorsDefault);
     $this->_age->setRequired(true);
     $this->_gender = new Zend_Form_Element_Text('gender');
     $this->_gender->setAttrib("id", "appraisaldelivery_gender");
     $this->_gender->setLabel("Sexo");
     $this->_gender->setDecorators($this->_decoratorsDefault);
     $this->_gender->setRequired(true);
     $this->_covenant = new Zend_Form_Element_Text('covenant');
     $this->_covenant->setAttrib("id", "appraisaldelivery_covenant");
     $this->_covenant->setLabel("Convênio");
     $this->_covenant->setDecorators($this->_decoratorsDefault);
     $this->_covenant->setRequired(true);
     $this->_doctor = new Zend_Form_Element_Text('doctor');
     $this->_doctor->setAttrib("id", "appraisaldelivery_doctor");
     $this->_doctor->setLabel("Médico");
     $this->_doctor->setDecorators($this->_decoratorsDefault);
     $this->_doctor->setRequired(true);
     $this->_dtpreview = new Zend_Form_Element_Text('dtpreview');
     $this->_dtpreview->setAttrib("id", "appraisaldelivery_dtpreview");
     $this->_dtpreview->setAttrib("class", "datepicker");
     $this->_dtpreview->setLabel("Data Prevista");
     $this->_dtpreview->setDecorators($this->_decoratorsDefault);
     $this->_dtpreview->setRequired(true);
     $this->_time = new Zend_Form_Element_Text('time');
     $this->_time->setAttrib("id", "appraisaldelivery_time");
     $this->_time->setAttrib("class", "mask_time");
     $this->_time->setLabel("Horário");
     $this->_time->setDecorators($this->_decoratorsDefault);
     $this->_time->setRequired(true);
     $this->_responsible = new Zend_Form_Element_Text('responsible');
     $this->_responsible->setAttrib("id", "appraisaldelivery_responsible");
     $this->_responsible->setLabel("Entregue para:");
     $this->_responsible->setDecorators($this->_decoratorsDefault);
     $this->_responsible->setRequired(true);
     $this->_date = new Zend_Form_Element_Text('date');
     $this->_date->setAttrib("id", "appraisaldelivery_date");
     $this->_date->setAttrib("class", "datepicker");
     $this->_date->setLabel("Data");
     $this->_date->setDecorators($this->_decoratorsDefault);
     $this->_date->setRequired(true);
     $this->_time2 = new Zend_Form_Element_Text('time2');
     $this->_time2->setAttrib("id", "appraisaldelivery_time2");
     $this->_time2->setAttrib("class", "mask_time");
     $this->_time2->setLabel("Horário");
     $this->_time2->setDecorators($this->_decoratorsDefault);
     $this->_time2->setRequired(true);
     //Aba Cobrança
     $this->_user = new Zend_Form_Element_Text('user');
     $this->_user->setAttrib("id", "appraisaldelivery_user");
     $this->_user->setAttrib("autocomplete", "off");
     //        $this->_user->setValue($userInfo->nmusergslab);
     $this->_user->setLabel("Usuário Responsável");
     $this->_user->setDecorators($this->_decoratorsDefault);
     $this->_user->setRequired(true);
     $this->_guiche = new Zend_Form_Element_Select('guiche');
     $this->_guiche->setAttrib("id", "appraisaldelivery_guiche");
     $this->_guiche->setAttrib("class", "multiple_select");
     $this->_guiche->setMultiOptions($arraycashdesk);
     $this->_guiche->setLabel("Guichê");
     $this->_guiche->setDecorators($this->_decoratorsDefault);
     $this->_guiche->setRegisterInArrayValidator(true);
     $this->_guiche->setRequired(true);
     $this->_dtcollection = new Zend_Form_Element_Text('dtcollection');
     $this->_dtcollection->setAttrib("id", "appraisaldelivery_dtcollection");
     $this->_dtcollection->setAttrib("class", "datepicker");
     $this->_dtcollection->setLabel("Data");
     $this->_dtcollection->setDecorators($this->_decoratorsDefault);
     $this->_dtcollection->setRequired(true);
     $this->_time3 = new Zend_Form_Element_Text('time3');
     $this->_time3->setAttrib("id", "appraisaldelivery_time3");
     $this->_time3->setAttrib("class", "mask_time");
     $this->_time3->setLabel("Horário");
     $this->_time3->setDecorators($this->_decoratorsDefault);
     $this->_time3->setRequired(true);
     $this->_examination = new Zend_Form_Element_Text('examination');
     $this->_examination->setAttrib("id", "appraisaldelivery_examination");
     $this->_examination->setValue("R\$ 0,00");
     $this->_examination->setLabel("Exames");
     $this->_examination->setDecorators($this->_decoratorsDefault);
     $this->_examination->setRequired(true);
     $this->_additionalitens = new Zend_Form_Element_Text('additionalitens');
     $this->_additionalitens->setAttrib("id", "appraisaldelivery_additionalitens");
     $this->_additionalitens->setValue("R\$ 0,00");
     $this->_additionalitens->setLabel("Itens Adicionais");
     $this->_additionalitens->setDecorators($this->_decoratorsDefault);
     //        $this->_additionalitens->setAttrib("class","mask_price");
     $this->_additionalitens->setRequired(true);
     $this->_anticipatedvalue = new Zend_Form_Element_Text('anticipatedvalue');
     $this->_anticipatedvalue->setAttrib("id", "appraisaldelivery_anticipatedvalue");
     $this->_anticipatedvalue->setValue("0");
     $this->_anticipatedvalue->setAttrib("class", "mask_price");
     $this->_anticipatedvalue->setLabel("Valor Antecipado");
     $this->_anticipatedvalue->setDecorators($this->_decoratorsDefault);
     $this->_anticipatedvalue->setRequired(true);
     $this->_amountpaid = new Zend_Form_Element_Text('amountpaid');
     $this->_amountpaid->setAttrib("id", "appraisaldelivery_amountpaid");
     $this->_amountpaid->setValue("0");
     $this->_amountpaid->setAttrib("class", "mask_price");
     $this->_amountpaid->setLabel("Valor Pago");
     $this->_amountpaid->setDecorators($this->_decoratorsDefault);
     $this->_amountpaid->setRequired(true);
     $this->_change = new Zend_Form_Element_Text('change');
     $this->_change->setAttrib("id", "appraisaldelivery_change");
     $this->_change->setValue("0");
     $this->_change->setLabel("Troco");
     $this->_change->setDecorators($this->_decoratorsDefault);
     $this->_change->setAttrib("class", "mask_price");
     $this->_change->setRequired(true);
     $this->_payment = new Zend_Form_Element_Select('payment');
     $this->_payment->setAttrib("id", "appraisaldelivery_payment");
     $this->_payment->setAttrib("class", "multiple_select");
     $this->_payment->setMultiOptions($arraypayment);
     $this->_payment->setLabel("Tipo de Pagamento");
     $this->_payment->setDecorators($this->_decoratorsDefault);
     $this->_payment->setRegisterInArrayValidator(true);
     $this->_payment->setRequired(true);
 }
 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');
 }