public function addServicoAction()
 {
     try {
         //$form = new Application_Form_Pcp(array('OPERADOR' => $this->user->getId()));
         $form = new Application_Form_Servico(array('OPERADOR' => $this->user->getId()));
         $form->submit->setLabel('Adicionar');
         //$form->removeElement("tabela_contratacao");
         $id_projeto = $this->_getParam('id_projeto', 0);
         if ($id_projeto > 0) {
             $formData["FK_PROJETO"] = $id_projeto;
             $form->populate($formData);
             $form->getElement("FK_PROJETO")->setAttrib("disable", true);
             $form->getElement("FK_PROJETO")->setRequired(false);
         }
         $this->view->form = $form;
         //$formData["FK_PROJETO"]="2247";
         //$form->populate($formData);
     } catch (Exception $e) {
         $this->view->mensagem = $e->getCode() . $e->getMessage();
         $this->view->erro = 1;
         $this->view->mensagemExcecao = $e->getMessage();
     }
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         Zend_Registry::get('logger')->log($formData, Zend_Log::INFO);
         if ($form->isValid($formData)) {
             try {
                 //$ID_SERVICO=$form->getValue('ID_SERVICO');
                 $DS_SERVICO = $form->getValue('DS_SERVICO');
                 $FK_OPERADOR = $this->user->getId();
                 $NR_CARGA_HORARIA = $form->getValue('NR_CARGA_HORARIA');
                 $FK_TIPO_SERVICO = $form->getValue('FK_TIPO_SERVICO');
                 $DT_SERVICO = $form->getValue('DT_SERVICO');
                 $data_cadastro = new Zend_Date($DT_SERVICO);
                 $DT_SERVICO = $data_cadastro->get('YYYY-MM-dd');
                 if ($id_projeto > 0) {
                     $FK_PROJETO = $id_projeto;
                 } else {
                     $FK_PROJETO = $form->getValue('FK_PROJETO');
                 }
                 $FL_PCP = 0;
                 $servico = new Application_Model_DbTable_Servico();
                 $servico->addServico($DS_SERVICO, $FK_OPERADOR, $NR_CARGA_HORARIA, $FK_TIPO_SERVICO, $DT_SERVICO, $FK_PROJETO, $FL_PCP);
                 //$descricao=$form->getValue('descricao');
                 //$centroCusto->addCentroCusto($descricao);
                 $this->view->erro = 0;
                 $this->view->mensagem = "Adicionado com sucesso";
                 $form->reset();
             } catch (Exception $erro) {
                 Zend_Registry::get('logger')->log("Erroooooooooooooooo", Zend_Log::INFO);
                 $this->view->mensagem = $erro->getMessage();
                 $this->view->erro = 1;
                 //exit;
             }
         } else {
             Zend_Registry::get('logger')->log("formulario inválido", Zend_Log::INFO);
             $form->populate($formData);
             $arrMessages = $form->getMessages();
             foreach ($arrMessages as $field => $arrErrors) {
                 $this->view->erro = 1;
                 $this->view->mensagem = $this->view->mensagem . $form->getElement($field)->getLabel() . $this->view->formErrors($arrErrors) . "<br>";
             }
         }
     }
 }