public function saveallAction()
 {
     $AppraisalData = $this->_request->getParam('allAppraisalData');
     $dscomment = $this->_request->getParam('dscomment');
     $userSession = Zend_Session::namespaceGet('Gslab_Session');
     $dateAppraisalTyping = date('Y-m-d');
     $bootstrap = $this->getInvokeArg('bootstrap');
     $gslab_db = $bootstrap->getResource('db');
     $cdappraisalArray = array();
     $appraisalModel = new AppraisalModel();
     $appraisalcommentModel = new AppraisalcommentModel();
     $appraisalattributeModel = new AppraisalattributeModel();
     $requestexaminationModel = new RequestexaminationModel();
     $gslab_db->beginTransaction();
     try {
         foreach ($AppraisalData as $appr) {
             $arrayAppraisal = array();
             $arrayAppraisal['cdrequest'] = $appr[1];
             $arrayAppraisal['cdusergslab'] = $userSession['user']->cdusergslab;
             $arrayAppraisal['dtappraisaltyping'] = $dateAppraisalTyping;
             $cdappraisal = $appraisalModel->insert($arrayAppraisal);
             if (strlen($appr[0]) == 0) {
                 // Insere Observação
                 $arrayAppraisalComment = array();
                 $arrayAppraisalComment['cdappraisal'] = $cdappraisal;
                 $arrayAppraisalComment['dscomment'] = $dscomment;
                 $appraisalcommentModel->insert($arrayAppraisalComment);
                 foreach ($appr[3] as $appAttr) {
                     if ($appAttr['name'] != 'cdappraisaltyping') {
                         // Explode a string em um Array onde as posições:
                         //      0 - CdRequestExamination;  1 - CdExamination;  2 - CdAttribute; 3 - CdExaminationMaterial
                         $txtidentifier = "appraisal_input_";
                         $identifierAppraisal = str_replace($txtidentifier, "", $appAttr['name']);
                         $arrayIdent = explode("_", $identifierAppraisal);
                         $arrayAppraisalAttribute = array();
                         $arrayAppraisalAttribute['cdrequestexamination'] = $arrayIdent[0];
                         $arrayAppraisalAttribute['cdappraisal'] = $cdappraisal;
                         $arrayAppraisalAttribute['cdattribute'] = $arrayIdent[2];
                         $arrayAppraisalAttribute['cdexaminationmaterial'] = $arrayIdent[3];
                         $arrayAppraisalAttribute['vlattribute'] = $appAttr['value'];
                         $appraisalattributeModel->insert($arrayAppraisalAttribute);
                         $requestexaminationModel->update(array("fgstatus" => 5), "cdrequestexamination = {$appr['2']}");
                     }
                 }
                 $cdappraisalArray[] = $cdappraisal;
             } else {
                 $appraisalattributeModel->delete("cdappraisal = {$appr['0']}");
                 $appraisalcommentModel->delete("cdappraisal = {$appr['0']}");
                 if (strlen($appr[4]) > 0) {
                     // Insere Observação
                     $arrayAppraisalComment = array();
                     $arrayAppraisalComment['cdappraisal'] = $appr[0];
                     $arrayAppraisalComment['dscomment'] = $appr[4];
                     $appraisalcommentModel->insert($arrayAppraisalComment);
                 }
                 foreach ($appr[3] as $appAttr) {
                     if ($appAttr['name'] != 'cdappraisaltyping') {
                         // Explode a string em um Array onde as posições:
                         //      0 - CdRequestExamination;  1 - CdExamination;  2 - CdAttribute; 3 - CdExaminationMaterial
                         $txtidentifier = "appraisal_input_";
                         $identifierAppraisal = str_replace($txtidentifier, "", $appAttr['name']);
                         $arrayIdent = explode("_", $identifierAppraisal);
                         $arrayAppraisalAttribute = array();
                         $arrayAppraisalAttribute['cdrequestexamination'] = $arrayIdent[0];
                         $arrayAppraisalAttribute['cdappraisal'] = $appr[0];
                         $arrayAppraisalAttribute['cdattribute'] = $arrayIdent[2];
                         $arrayAppraisalAttribute['cdexaminationmaterial'] = $arrayIdent[3];
                         $arrayAppraisalAttribute['vlattribute'] = $appAttr['value'];
                         $appraisalattributeModel->insert($arrayAppraisalAttribute);
                         $requestexaminationModel->update(array("fgstatus" => 5), "cdrequestexamination = {$appr['2']}");
                     }
                 }
                 $cdappraisalArray[] = $appr[0];
             }
         }
         $gslab_db->commit();
         $return[0] = 1;
         $return[1] = "Todas os resultados digitados foram salvos com sucesso!";
         $return[2] = $cdappraisalArray;
         $this->view->saveall = $return;
     } catch (Exception $e) {
         $gslab_db->rollback();
         $return[0] = 0;
         $return[1] = "Os resultados digitados não puderam ser salvos!";
         $return[2] = '';
         $this->view->saveall = $return;
     }
 }
 public function saveAction()
 {
     $this->_model->getAdapter()->beginTransaction();
     $paramSample = $this->_request->getParam('data');
     //    print_r($paramSample); die;
     $date = $this->_request->getParam('date');
     $time = $this->_request->getParam('time');
     $delivery = $this->_request->getParam('delivery');
     $cdusergslab = $this->_request->getParam('cdusergslab');
     $paramSampleArray = array();
     $RequestArray = array();
     $modelRequest = new RequestexaminationModel();
     try {
         $date = new Zend_Date($date, 'dd-MM-YY');
         $date = $date->toString('YYYY-MM-dd');
         foreach ($paramSample as $row) {
             $paramSampleArray = array('cdrequestexaminationsample' => $row['cdreqexasam'], 'cdusergslab' => $cdusergslab, 'dtsamplereceivingdate' => $date, 'nmsamplereceivingperson' => $delivery);
             $RequestArray = array('fgstatus' => 1);
             $this->_model->insert($paramSampleArray);
             $modelRequest->update($RequestArray, "cdrequestexamination = " . $row['cdrequestexamination']);
             $fgstatus = 1;
         }
         $message = 'Cadastro efetuado com sucesso';
         $this->_model->getAdapter()->commit();
     } catch (Exception $e) {
         $message = "Erro na inserção dos dados." + $e->getMessage();
         $this->_model->getAdapter()->rollBack();
     }
     $this->view->fgstatus = $fgstatus;
 }
    public function generateprotocolAction($cdrequest = 1)
    {
        require_once 'fpdf/pdf_protocol.php';
        $gslabSession = Zend_Session::namespaceGet('Gslab_Session');
        $cdcompany = $gslabSession['user']->cdcompany;
        $companyModel = new CompanyModel();
        $requestModel = new RequestModel();
        $sampleModel = new RequestexaminationsampleModel();
        $clientModel = new ClientModel();
        $covenantModel = new CovenantModel();
        $forwardModel = new ForwardModel();
        $examinationModel = new RequestexaminationModel();
        $companyData = $companyModel->fetchRow('cdcompany = ' . $cdcompany);
        $requestData = $requestModel->fetchRow('cdrequest = ' . $cdrequest);
        $sampleData = $sampleModel->fetchRow('cdrequest = ' . $cdrequest);
        $clientData = $clientModel->fetchRow('cdclient = ' . $requestData->cdclient);
        $covenantData = $covenantModel->fetchRow('cdcovenant = ' . $requestData->cdcovenant);
        $forwardData = $forwardModel->fetchRow('cdforward = ' . $requestData->cdforward);
        $dtbirth = new Zend_Date($clientData->dtbirth, 'dd-MM-YYYY');
        $dtrequest = new Zend_Date($requestData->dtrequest, 'dd-MM-YYYY HH:mm');
        $dtdeadline = new Zend_Date($requestData->dtdeadline, 'dd-MM-YYYY HH:mm');
        $year = $dtbirth->toString('YYYY');
        $month = $dtbirth->toString('MM');
        $day = $dtbirth->toString('dd');
        $today = new Zend_Date();
        $tdYear = $today->toString('YYYY');
        $tdMonth = $today->toString('MM');
        $tdDay = $today->toString('dd');
        $nrage = 0;
        $nrage = GslabUtils::calcAgeDifferenceShort($clientData->dtbirth);
        $idade = GslabUtils::calcula_idade($clientData->dtbirth);
        if ($clientData->fgsex == 1) {
            $sexo = 'M';
        } else {
            $sexo = 'F';
        }
        if ($tdMonth < $month || $tdMonth == $month && $tdDay < $day) {
            $nrage--;
        }
        $pdf = new PDF_PROTOCOL();
        $pdf->AddPage();
        $pdf->SetFont('Courier', 'B', 11);
        $pdf->ln(55);
        $pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmcompany)), 0, 1, 'C');
        $pdf->Cell(0, 8, utf8_decode('LABORATÓRIO DE ANÁLISES CLÍNICAS'), 0, 2, 'C');
        $pdf->Cell(0, -5, str_repeat('_', 81), 0, 1, 'L');
        $pdf->ln(8);
        $pdf->SetFont('Helvetica', '', 9);
        $pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmstreet) . ', ' . $companyData->nrnumber), 0, 1, 'L');
        $pdf->ln(4);
        $pdf->Cell(0, 0, 'COMPROVANTE DE COLETA', 0, 1, 'L');
        $pdf->Cell(0, 0, utf8_decode(strtoupper($companyData->nmneighborhood)) . ' - Fone: (47) 3427-3668', 0, 1, 'R');
        //ADICIONAR TELEFONE NA BASE
        $pdf->ln(4);
        $pdf->Cell(0, 0, utf8_decode('Ficha: ') . $requestData->cdcompany . "-" . $requestData->cdrequest, 0, 1, 'L');
        $pdf->Cell(0, 0, 'Senha: 2301', 0, 1, 'R');
        $pdf->ln(8);
        $pdf->Cell(0, 0, utf8_decode('PRONTUÁRIO'), 0, 1, 'L');
        $pdf->ln(4);
        $pdf->SetFont('Helvetica', '', 10);
        $pdf->Cell(15, 5, utf8_decode('Amostra: '), 0, 0, 'L');
        $pdf->Cell(0, 5, $pdf->SetFont('Helvetica', 'BU', 10) . $sampleData->nmbarcodesample, 0, 1, 'L');
        $pdf->ln(4);
        $pdf->SetFont('Helvetica', 'BU', 10);
        $pdf->Write(0, utf8_decode(strtoupper($clientData->nmclient)));
        $pdf->SetFont('Helvetica', '', 10);
        $pdf->ln(8);
        $pdf->Write(0, utf8_decode('Idade: ' . $nrage));
        $pdf->Write(0, utf8_decode(' Sexo: ' . $sexo));
        $pdf->ln(6);
        $pdf->Write(0, utf8_decode('Convênio: ' . $covenantData->nmcovenant));
        $pdf->ln(6);
        $pdf->Write(0, utf8_decode('Médico: ' . $forwardData->idmaincrm . ' - ' . $forwardData->nmforward));
        $pdf->ln(6);
        $pdf->Write(0, utf8_decode('Coleta: ' . strtoupper($companyData->cdcompany . ' - ' . $companyData->nmfantasyname)));
        $pdf->ln(6);
        $pdf->Write(0, utf8_decode('Data e Hora: ') . $dtrequest);
        $pdf->ln(4);
        $pdf->SetFont('Courier', 'B', 11);
        $pdf->Cell(0, 0, str_repeat('_', 81), 0, 1, 'L');
        /* CAIXA LATERAL */
        $pdf->SetFont('Helvetica', '', 10);
        $pdf->SetY(89);
        $pdf->SetX(90);
        $pdf->drawTextBox(utf8_decode('Provável local e data da entrega:
Local: ' . strtoupper($companyData->nmfantasyname) . '
Data: ' . $dtdeadline . '
Salvo quando ocorrer:
    1-	Imprevistos técnicos
    2-	Bloqueio de resultado pelo controle de qualidade
    3-	Atraso no fornecimento de reagentes
Autorizo a coleta do(s) exame(s) acima citado(s) e declaro estar ciente dos riscos quanto ao surgimento de possíveis hematomas no local da punção.
Assinatura do cliente e/ou responsável:__________________________________________'), 109, 50, 'L', 'M');
        /* doze exames */
        $Exames = $examinationModel->fetchAll($examinationModel->getExaminationProtocol($cdrequest));
        $pdf->ln(13);
        // Exames
        $pdf->SetFont('Helvetica', 'B', 9);
        $pdf->SetWidths(array(50, 23, 18));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('Exames'), utf8_decode('Material'), utf8_decode('Status')));
        $pdf->SetFont('Helvetica', '', 9);
        $i = 0;
        foreach ($Exames as $examination) {
            if ($examination['nmmaterial'] == 2) {
                $status = 'Faltante';
            } else {
                $status = 'OK';
            }
            if ($i == 11) {
                $pdf->SetY(148);
            }
            $pdf->SetX(10);
            $pdf->Row(array(utf8_decode($examination['nmexamination']), utf8_decode($examination['nmmaterial']), $status));
            $i++;
        }
        $pdf->ln(5);
        /* -------------------------------------------------------------- */
        /* PESQUISA DE SATISFAÇÃO */
        $pdf->SetFont('Helvetica', '', 7);
        $pdf->SetY(205);
        $pdf->Cell(0, 0, str_repeat(' -', 125), 0, 1, 'L');
        $pdf->SetX(10);
        $pdf->Write(5, utf8_decode('Prezado cliente: com o objetivo de melhorarmos cada vez mais a'));
        $pdf->ln(3);
        $pdf->SetX(10);
        $pdf->Write(5, utf8_decode('qualidade dos nossos serviços e o atendimento à você, solicitamos'));
        $pdf->ln(3);
        $pdf->SetX(10);
        $pdf->Write(5, utf8_decode('a sua gentileza preenchendo o formulário abaixo.'));
        $pdf->ln(5);
        $pdf->SetFont('Helvetica', 'B', 7);
        $pdf->SetWidths(array(30, 13, 13, 13, 13));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('Assinale sua opinião'), utf8_decode('Ótimo'), 'Bom', 'Regular', 'Ruim'));
        $pdf->SetFont('Helvetica', '', 7);
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('1. Como foi o atendimento ao telefone?'), '', '', '', ''));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('2. Como foi o atendimento da recepção?'), '', '', '', ''));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('3. Quanto ao conforto e bem estar na sala de espera?'), '', '', '', ''));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('4. Quanto à coleta do material para o exame?'), '', '', '', ''));
        $pdf->SetX(10);
        $pdf->Row(array(utf8_decode('5. Quanto ao prazo e entrega dos resultados?'), '', '', '', ''));
        $pdf->SetY(215);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('6. Como conheceu o Laboratório? _______________________________'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('7. Você indicaria o laboratório para outras pessoas?  (  ) Sim   (  ) Não'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('Se NÃO, por quê?____________________________________________'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('8. Conhece nosso '));
        $pdf->SetFont('Helvetica', 'BU', 7);
        $pdf->Write(5, utf8_decode('Programa de Coleta Domiciliar'));
        $pdf->SetFont('Helvetica', '', 7);
        $pdf->Write(5, utf8_decode(' (tel: 3433-2127)?'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('(  ) Sim   (  ) Não'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('9. Sugestões e críticas:_______________________________________'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('__________________________________________________________'));
        $pdf->ln(7);
        $pdf->SetX(117);
        $pdf->Write(5, utf8_decode('__________________________________________________________'));
        $pdf->Output();
        //IMPRIME O PDF NA TELA
        $pdf->Output('teste_pro.pdf', "D");
        //IMPRIME O PDF NO ARQUIVO
    }
 public function saveAction()
 {
     //print_r($_POST);die;
     $this->_model->getAdapter()->beginTransaction();
     $paramApp = $this->_request->getParam('data');
     $request = $this->_request->getParam('request');
     $delivery = $this->_request->getParam('delivery');
     $date = $this->_request->getParam('date');
     $time = $this->_request->getParam('time');
     //$RequestArray = array();
     try {
         $date = new Zend_Date($date, 'dd-MM-YY');
         $date = $date->toString('YYYY-MM-dd');
         $date = $date . " " . $time . ":00";
         $paramAppArray = array('cdrequest' => $request, 'nmdeliveryperson' => $delivery, 'dtappraisaldelivery' => $date);
         $this->_model->insert($paramAppArray);
         $message = 'Cadastro efetuado com sucesso';
         $this->_model->getAdapter()->commit();
     } catch (Exception $e) {
         $message = "Erro na inserção dos dados." + $e->getMessage();
         $this->_model->getAdapter()->rollBack();
     }
     $this->view->message = $message;
     $modelRequest = new RequestexaminationModel();
     $RequestArray = array('fgstatus' => 6);
     $modelRequest->update($RequestArray, "fgstatus = 5");
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     $arrayPriority = array('1' => 'Normal', '2' => 'Urgente');
     $covenantModel = new CovenantModel();
     $selectCovenant = $covenantModel->fetchAll();
     $arrayCovenant = array();
     $arrayCovenant['0'] = "0";
     foreach ($selectCovenant as $selCv) {
         $arrayCovenant[$selCv->cdcovenant] = $selCv->nmcovenant;
     }
     $departmentModel = new DepartmentModel();
     $selectDepartment = $departmentModel->fetchAll();
     $arrayDepartment = array();
     $arrayDepartment['0'] = "0";
     foreach ($selectDepartment as $selDP) {
         $arrayDepartment[$selDP->cddepartment] = $selDP->nmdepartment;
     }
     $uncollectionModel = new CompanyModel();
     $selectCompany = $uncollectionModel->fetchAll("cdcompanyparent IS NOT NULL");
     $arrayuncollection = array();
     $arrayuncollection['0'] = "0";
     foreach ($selectCompany as $cdplace) {
         $arrayuncollection[$cdplace->cdcompany] = $cdplace->nmfantasyname;
     }
     $fgstatusModel = new RequestexaminationModel();
     $selectstatus = $fgstatusModel->fetchAll();
     $arrayfgstatus = array();
     $arrayfgstatus['0'] = "Selecione";
     foreach ($selectstatus as $cdstatus) {
         $arrayfgstatus[$cdstatus->cdrequestexamination] = $cdstatus->fgstatus;
     }
     //Novas...
     $this->_departament = new Zend_Form_Element_Select('departament');
     $this->_departament->setAttrib("id", "maps_departament");
     $this->_departament->setAttrib("class", "check_multiple_select");
     $this->_departament->setMultiOptions($arrayDepartment);
     $this->_departament->setLabel("Setor");
     $this->_departament->setDecorators($this->_decoratorsDefault);
     $this->_departament->setRegisterInArrayValidator(true);
     $this->_departament->setRequired(true);
     $this->_covenant = new Zend_Form_Element_Select('covenant');
     $this->_covenant->setAttrib("id", "maps_covenant");
     $this->_covenant->setAttrib("class", "check_multiple_select");
     $this->_covenant->setMultiOptions($arrayCovenant);
     $this->_covenant->setLabel("Convênio");
     $this->_covenant->setDecorators($this->_decoratorsDefault);
     $this->_covenant->setRegisterInArrayValidator(true);
     $this->_covenant->setRequired(true);
     $this->_uncollection = new Zend_Form_Element_Select('uncollection');
     $this->_uncollection->setAttrib("id", "maps_uncollection");
     $this->_uncollection->setAttrib("class", "check_multiple_select");
     $this->_uncollection->setMultiOptions($arrayuncollection);
     $this->_uncollection->setLabel("Unidade de Coleta");
     $this->_uncollection->setDecorators($this->_decoratorsDefault);
     $this->_uncollection->setRegisterInArrayValidator(true);
     $this->_uncollection->setRequired(true);
     $this->_stsample = new Zend_Form_Element_Select('stsample');
     $this->_stsample->setAttrib("id", "maps_stsample");
     $this->_stsample->setAttrib("class", "multiple_select");
     $this->_stsample->setMultiOptions($arrayfgstatus);
     $this->_stsample->setLabel("Status Amostra");
     $this->_stsample->setDecorators($this->_decoratorsDefault);
     $this->_stsample->setRegisterInArrayValidator(true);
     $this->_stsample->setRequired(true);
     $this->_priority = new Zend_Form_Element_Select('priority');
     $this->_priority->setAttrib("id", "maps_priority");
     $this->_priority->setAttrib("class", "check_multiple_select");
     $this->_priority->setMultiOptions($arrayPriority);
     $this->_priority->setLabel("Prioridade");
     $this->_priority->setDecorators($this->_decoratorsDefault);
     $this->_priority->setRegisterInArrayValidator(true);
     $this->_priority->setRequired(true);
     $this->_dtstart = new Zend_Form_Element_Text('dtstart');
     $this->_dtstart->setAttrib("id", "maps_dtstart");
     $this->_dtstart->setAttrib("class", "datepicker");
     $this->_dtstart->setLabel("Data Inicial");
     $this->_dtstart->setDecorators($this->_decoratorsDefault);
     $this->_dtstart->setRequired(false);
     $this->_dtend = new Zend_Form_Element_Text('dtend');
     $this->_dtend->setAttrib("id", "maps_dtend");
     $this->_dtend->setAttrib("class", "datepicker");
     $this->_dtend->setLabel("Data Final");
     $this->_dtend->setDecorators($this->_decoratorsDefault);
     $this->_dtend->setRequired(false);
 }
 public function saveAction()
 {
     $bootstrap = $this->getInvokeArg('bootstrap');
     $gslab_db = $bootstrap->getResource('db');
     $deliveryModel = new AppraisaldeliveryModel();
     $modelRequest = new RequestexaminationModel();
     $gslab_db->beginTransaction();
     $paramApp = $this->_request->getParam('data');
     $request = $this->_request->getParam('request');
     $delivery = $this->_request->getParam('delivery');
     $date = $this->_request->getParam('date');
     $time = $this->_request->getParam('time');
     $dtdelivery = GslabUtils::dateToDatabaseFormat($date);
     $datahora = substr($dtdelivery, 0, -8);
     try {
         $paramAppArray = array('cdrequest' => $request, 'nmdeliveryperson' => $delivery, 'dtappraisaldelivery' => $datahora . $time . ":00");
         $deliveryModel->insert($paramAppArray);
         $message = 'Cadastro efetuado com sucesso';
         $gslab_db->commit();
     } catch (Exception $e) {
         $message = "Erro na inserção dos dados." + $e->getMessage();
         $this->_model->getAdapter()->rollBack();
     }
     $this->view->message = $message;
     $RequestArray = array('fgstatus' => 6);
     $modelRequest->update($RequestArray, "cdrequest = " . $request . " AND fgstatus = 5");
 }
 public function saveAction()
 {
     $AppraisalData = $this->_request->getParam('AppraisalData');
     $cdRequest = $this->_request->getParam('cdrequest');
     $cdRequestExamination = $this->_request->getParam('cdrequestexamination');
     $dscomment = $this->_request->getParam('dscomment');
     $userSession = Zend_Session::namespaceGet('Gslab_Session');
     $dateAppraisalTyping = date('Y-m-d');
     $bootstrap = $this->getInvokeArg('bootstrap');
     $gslab_db = $bootstrap->getResource('db');
     $appraisalModel = new AppraisalModel();
     $appraisalattributeModel = new AppraisalattributeModel();
     $appraisalcommentModel = new AppraisalcommentModel();
     $requestexaminationModel = new RequestexaminationModel();
     $gslab_db->beginTransaction();
     try {
         $arrayAppraisal = array();
         $arrayAppraisal['cdrequest'] = $cdRequest;
         $arrayAppraisal['cdusergslab'] = $userSession['user']->cdusergslab;
         $arrayAppraisal['dtappraisaltyping'] = $dateAppraisalTyping;
         $appraisalModel->insert($arrayAppraisal);
         $cdappraisal = $appraisalModel->getAdapter()->lastInsertId();
         // Insere Observação
         $arrayAppraisalComment = array();
         $arrayAppraisalComment['cdappraisal'] = $cdappraisal;
         $arrayAppraisalComment['dscomment'] = $dscomment;
         $appraisalcommentModel->insert($arrayAppraisalComment);
         foreach ($AppraisalData as $appAttr) {
             if ($appAttr['name'] != 'cdappraisaltyping') {
                 // Explode a string em um Array onde as posições:
                 //      0 - CdRequestExamination;  1 - CdExamination;  2 - CdAttribute; 3 - CdExaminationMaterial
                 $txtidentifier = "appraisal_input_";
                 $identifierAppraisal = str_replace($txtidentifier, "", $appAttr['name']);
                 $arrayIdent = explode("_", $identifierAppraisal);
                 $arrayAppraisalAttribute = array();
                 $arrayAppraisalAttribute['cdrequestexamination'] = $arrayIdent[0];
                 $arrayAppraisalAttribute['cdappraisal'] = $cdappraisal;
                 $arrayAppraisalAttribute['cdattribute'] = $arrayIdent[2];
                 $arrayAppraisalAttribute['cdexaminationmaterial'] = $arrayIdent[3];
                 $arrayAppraisalAttribute['vlattribute'] = $appAttr['value'];
                 $appraisalattributeModel->insert($arrayAppraisalAttribute);
             }
         }
         $requestexaminationModel->update(array("fgstatus" => 4), "cdrequestexamination = {$cdRequestExamination}");
         $gslab_db->commit();
         $return[0] = 1;
         $return[1] = "Digitação salva com sucesso!";
         $return[2] = $cdappraisal;
         $this->view->save = $return;
     } catch (Exception $e) {
         $gslab_db->rollback();
         $return[0] = 0;
         $return[1] = "A Digitação não pode ser salva!";
         $return[2] = null;
         $this->view->save = $return;
     }
 }