public function saveAction()
 {
     $uniqueitens = array();
     $trackErrors = 0;
     $returnsaverequest = array();
     $userInfo = $_SESSION['Gslab_Session']['user'];
     $bootstrap = $this->getInvokeArg('bootstrap');
     $gslab_db = $bootstrap->getResource('db');
     $values = $this->_request->getParams();
     $billingtabdata = json_decode($values['billingtabdata'], true);
     if (isset($values['additionalitensgrid']) && $values['additionalitensgrid'] != null) {
         $additionalitens = $values['additionalitensgrid'];
     }
     if (isset($additionalitens) && $additionalitens != 'null') {
         $additionalitens = json_decode($additionalitens, true);
         foreach ($additionalitens as $unique) {
             $uniqueitens[] = $unique['cdsupply'];
         }
     }
     $billingtabdata['fgaccountentrytype'] = 1;
     $billingtabdata['fgaccountcheck'] = 1;
     //        var_dump($billingtabdata);
     //        var_dump($values);
     //        var_dump(array_unique($uniqueitens)); die;
     $requestModel = new RequestModel();
     $accentryModel = new AccountentryModel();
     if (isset($values['dtrequest']) && $values['dtrequest'] != '') {
         $dtrequest = $this->_request->getParam('dtrequest');
         $daterq = new Zend_Date($dtrequest, 'dd-MM-YYYY HH:mm:ss');
         $values['dtrequest'] = $daterq->toString('YYYY-MM-dd HH:mm:ss');
     }
     if (isset($values['dtdeadline']) && $values['dtdeadline'] != '') {
         $dtdeadline = $this->_request->getParam('dtdeadline');
         $datedl = new Zend_Date($dtdeadline, 'dd-MM-YYYY HH:mm:ss');
         $values['dtdeadline'] = $datedl->toString('YYYY-MM-dd HH:mm:ss');
     }
     if (isset($billingtabdata['dtentrydate']) && $billingtabdata['dtentrydate'] != '') {
         $dtentrydate = $billingtabdata['dtentrydate'];
         $dateed = new Zend_Date($dtentrydate, 'dd-MM-YYYY HH:mm:ss');
         $billingtabdata['dtentrydate'] = $dateed->toString('YYYY-MM-dd HH:mm:ss');
     }
     if (isset($values)) {
         $gslab_db->beginTransaction();
         try {
             $columnsRequest = $requestModel->info(Zend_Db_Table_Abstract::COLS);
             $columnsAccEntry = $accentryModel->info(Zend_Db_Table_Abstract::COLS);
             $arrayRequest = array();
             $arrayAccEntry = array();
             $arrayAccEntryReq = array();
             $arrayAccEntrySupply = array();
             $arrayAccCheck = array();
             $arrayAccCheckAccEntry = array();
             $arraySupplyFlow = array();
             foreach ($values as $id => $value) {
                 if (isset($value) && $value != '' && in_array($id, $columnsRequest)) {
                     $arrayRequest[$id] = addslashes($value);
                 }
             }
             if (isset($values['cdrequest']) && $values['cdrequest'] == '') {
                 $requestModel->insert($arrayRequest);
                 $lastCDrequest = $gslab_db->lastInsertId();
             } else {
                 // Ativa a Requisição (que já foi salva como inativa ao realizar a troca de abas)
                 $arrayRequest['fgactive'] = 1;
                 $requestModel->update($arrayRequest, "request.cdrequest = " . $values['cdrequest']);
             }
             //                $requestModel->getAdapter()->commit();
             // Verifica se existem itens a serem salvos!
             if (isset($additionalitens) && $additionalitens != 'null') {
                 // Salva Dados na AccountEntry
                 //                    $accentryModel->getAdapter()->beginTransaction();
                 try {
                     foreach ($billingtabdata as $id => $value) {
                         if (isset($value) && $value != '' && in_array($id, $columnsAccEntry)) {
                             $arrayAccEntry[$id] = addslashes($value);
                         }
                     }
                     $arrayAccEntry['cdclient'] = $values['cdclient'];
                     $arrayAccEntry['dttransactiondate'] = $values['dtrequest'];
                     $arrayAccEntry['dtdeadline'] = $values['dtdeadline'];
                     $arrayAccEntry['dtinvoicedate'] = $values['dtdeadline'];
                     $accentryModel->insert($arrayAccEntry);
                     $lastCDaccEntry = $gslab_db->lastInsertId();
                     //                         $accentryModel->getAdapter()->commit();
                 } catch (Exception $ae) {
                     //                        $accentryModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Entrada de Contas";
                 }
                 // Salva Dados na AccountEntryRequest
                 $accountentryrequestModel = new AccountentryrequestModel();
                 //                    $accountentryrequestModel->getAdapter()->beginTransaction();
                 try {
                     $arrayAccEntryReq["cdaccountentry"] = $lastCDaccEntry;
                     if (!isset($values['cdrequest'])) {
                         $arrayAccEntryReq["cdrequest"] = $lastCDrequest;
                     } else {
                         $arrayAccEntryReq["cdrequest"] = $values['cdrequest'];
                     }
                     $accountentryrequestModel->insert($arrayAccEntryReq);
                     //                        $accountentryrequestModel->getAdapter()->commit();
                 } catch (Exception $aeq) {
                     //                        $accountentryrequestModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Requisiçao/Cobrança ";
                 }
                 // Salva Dados na SupplyFlow
                 $supplyflowModel = new SupplyflowModel();
                 //                    $supplyflowModel->getAdapter()->beginTransaction();
                 try {
                     if (isset($additionalitens)) {
                         foreach ($additionalitens as $itens) {
                             $arraySupplyFlow["cdsupply"] = $itens['cdsupply'];
                             $arraySupplyFlow["qtquantity"] = $itens['amount'];
                             $arraySupplyFlow["cdsupplycentrefrom"] = $itens['cdsupplycentre'];
                             $arraySupplyFlow["cdsupplycentreto"] = 1;
                             $arraySupplyFlow["fgsupplyioreason"] = 1;
                             $arraySupplyFlow["dtcheckout"] = $values['dtrequest'];
                             $supplyflowModel->insert($arraySupplyFlow);
                         }
                         //                            $supplyflowModel->getAdapter()->commit();
                     }
                 } catch (Exception $sfw) {
                     //                        $supplyflowModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Movimentação de Itens";
                 }
                 //|
                 //====> Desconta Itens do Estoque no SupplyStock
                 $supplystockModel = new SupplyStockModel();
                 //                            $supplystockModel->getAdapter()->beginTransaction();
                 try {
                     if (isset($additionalitens)) {
                         foreach ($additionalitens as $itens) {
                             $datadiscount = array("qtquantity" => new Zend_Db_Expr("qtquantity - " . $itens['amount']), "qtsupplybalance" => new Zend_Db_Expr("qtsupplybalance - " . $itens['amount']), "dtcheckin" => $values['dtrequest']);
                             $supplystockModel->getAdapter()->update('supplystock', $datadiscount, "cdsupply = " . $itens['cdsupply'] . " AND cdsupplycentre = " . $itens['cdsupplycentre']);
                         }
                         //                                    $supplystockModel->getAdapter()->commit();
                     }
                 } catch (Exception $sstk) {
                     //                                $supplystockModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Desconto do Estoque";
                 }
                 // Salva Dados na AccountEntrySupply
                 $accountentrysupplyModel = new AccountentrysupplyModel();
                 //                    $accountentrysupplyModel->getAdapter()->beginTransaction();
                 try {
                     if (isset($uniqueitens)) {
                         foreach ($uniqueitens as $itens) {
                             $arrayAccEntrySupply["cdaccountentry"] = $lastCDaccEntry;
                             $arrayAccEntrySupply["cdsupply"] = $itens;
                             $accountentrysupplyModel->insert($arrayAccEntrySupply);
                         }
                         //                            $accountentrysupplyModel->getAdapter()->commit();
                     }
                 } catch (Exception $aes) {
                     //                        $accountentrysupplyModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Entradas de contas/Itens";
                 }
                 // Salva Dados na AccountCheck
                 $accountcheckModel = new AccountcheckModel();
                 $accountcheckaccountentryModel = new accountcheckaccountentryModel();
                 //                    $accountcheckModel->getAdapter()->beginTransaction();
                 try {
                     if (isset($values['dtrequest']) && isset($billingtabdata['vlaccountcheckvalue'])) {
                         $arrayAccCheck['cdusergslab'] = $billingtabdata['cdusergslab'];
                         $arrayAccCheck['dtaccountcheckdate'] = $values['dtrequest'];
                         $arrayAccCheck['vlaccountcheckvalue'] = $billingtabdata['vlaccountcheckvalue'];
                         $accountcheckModel->insert($arrayAccCheck);
                         $arrayAccCheckAccEntry['cdaccountcheck'] = $accountcheckModel->getAdapter()->lastInsertId();
                         $arrayAccCheckAccEntry['cdaccountentry'] = $lastCDaccEntry;
                         $accountcheckaccountentryModel->insert($arrayAccCheckAccEntry);
                         //                            $accountcheckModel->getAdapter()->commit();
                     }
                 } catch (Exception $aes) {
                     //                        $accountcheckModel->getAdapter()->rollBack();
                     $trackErrors++;
                     $returnsaverequest['idreturn'] = 0;
                     $returnsaverequest['messagereturn'] = "Erro: Checagem de contas";
                 }
             }
             if ($trackErrors == 0) {
                 $gslab_db->commit();
                 $returnsaverequest['idreturn'] = 1;
                 $returnsaverequest['messagereturn'] = "Cadastro efetuado com sucesso.";
             }
             $this->view->returnSaveRequest = $returnsaverequest;
         } catch (Exception $e) {
             $gslab_db->rollBack();
             //                $requestModel->getAdapter()->rollBack();
             $returnsaverequest['idreturn'] = 0;
             $returnsaverequest['messagereturn'] = "Erro ao salvar a requisição.";
             $this->view->returnSaveRequest = $returnsaverequest;
         }
     }
 }
 public function saveAction()
 {
     //  parent::saveAction();
     $message = '';
     $AccountEntryModel = new AccountentryModel();
     $AccountEntryModel->getAdapter()->beginTransaction();
     $AccountCheckModel = new AccountcheckModel();
     $accountentrycheckModel = new AccountcheckaccountentryModel();
     $paramAccountentry = array();
     $paramAccountcheck = array();
     $paramentrycheckArray = array();
     $dtentrydate = $this->_request->getParam("dtentrydate");
     if ($dtentrydate != '' && isset($dtentrydate)) {
         $dtentrydate = new Zend_Date($dtentrydate, 'dd-MM-YYYY');
         $dtentrydate = $dtentrydate->toString('YYYY-MM-dd');
     }
     $dttransactiondate = $this->_request->getParam("dttransactiondate");
     if ($dttransactiondate != '' && isset($dttransactiondate)) {
         $dttransactiondate = new Zend_Date($dttransactiondate, 'dd-MM-YYYY');
         $dttransactiondate = $dttransactiondate->toString('YYYY-MM-dd');
     }
     $dtinvoicedate = $this->_request->getParam("dtinvoicedate");
     if ($dtinvoicedate != '' && isset($dtinvoicedate)) {
         $dtinvoicedate = new Zend_Date($dtinvoicedate, 'dd-MM-YYYY');
         $dtinvoicedate = $dtinvoicedate->toString('YYYY-MM-dd');
     }
     $dtdeadline = $this->_request->getParam("dtdeadline");
     if ($dtdeadline != '' && isset($dtdeadline)) {
         $dtdeadline = new Zend_Date($dtdeadline, 'dd-MM-YYYY');
         $dtdeadline = $dtdeadline->toString('YYYY-MM-dd');
     }
     $dtaccountcheckdate = $this->_request->getParam("dtaccountcheckdate");
     if ($dtaccountcheckdate != '' && isset($dtaccountcheckdate)) {
         $dtaccountcheckdate = new Zend_Date($dtaccountcheckdate, 'dd-MM-YYYY');
         $dtaccountcheckdate = $dtaccountcheckdate->toString('YYYY-MM-dd');
     }
     $supplierModel = new SupplierModel();
     $covenantModel = new CovenantModel();
     if ($this->_request->getParam('fgclienttype') == 'a' && $this->_request->getParam('cdclient') != '') {
         if ($this->_request->getParam('cdclient') != null && $this->_request->getParam('cdclient') != '') {
             $favored = $this->_request->getParam('cdclient');
         }
     } else {
         if ($this->_request->getParam('fgclienttype') == 'b' && $this->_request->getParam('cdclient') != '') {
             if ($this->_request->getParam('cdclient') != null && $this->_request->getParam('cdclient') != '') {
                 $patientData = $covenantModel->fetchRow('cdcovenant = ' . $this->_request->getParam('cdclient'));
                 $favored = $patientData->cdcovenant;
             }
         }
     }
     if ($this->_request->getParam('cdsupplier') != '' && $this->_request->getParam('fgopernature') != '') {
         $paramAccountentry = array('cdsupplier' => $this->_request->getParam('cdsupplier'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'cdusergslab' => $this->_request->getParam('cduser'), 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'), 'cdopernature' => $this->_request->getParam('fgopernature'));
     } else {
         if ($this->_request->getParam('cdsupplier') != '') {
             $paramAccountentry = array('cdsupplier' => $this->_request->getParam('cdsupplier'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'cdusergslab' => $this->_request->getParam('cduser'), 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'));
         } else {
             if ($this->_request->getParam('cdclient') != '' && $this->_request->getParam('fgclienttype') == 'a' && $this->_request->getParam('fgopernature') != '') {
                 $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'cdclient' => $favored, 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'), 'cdopernature' => $this->_request->getParam('fgopernature'));
             } else {
                 if ($this->_request->getParam('cdclient') != '' && $this->_request->getParam('fgclienttype') == 'a') {
                     $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'cdclient' => $favored, 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'));
                 } else {
                     if ($this->_request->getParam('cdclient') != '' && $this->_request->getParam('fgclienttype') == 'b' && $this->_request->getParam('fgopernature') != '') {
                         $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'cdclient' => $favored, 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'), 'cdopernature' => $this->_request->getParam('fgopernature'));
                     } else {
                         if ($this->_request->getParam('cdclient') != '' && $this->_request->getParam('fgclienttype') == 'b') {
                             $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'cdclient' => $favored, 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'));
                         } else {
                             if ($this->_request->getParam('cdclient') == '' && $this->_request->getParam('cdsupplier') == '' && $this->_request->getParam('fgopernature') != '') {
                                 $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'), 'cdopernature' => $this->_request->getParam('fgopernature'));
                             } else {
                                 if ($this->_request->getParam('cdclient') == '' && $this->_request->getParam('cdsupplier') == '') {
                                     $paramAccountentry = array('cdusergslab' => $this->_request->getParam('cduser'), 'nraccountentry' => $this->_request->getParam('nraccountentry'), 'fgaccountentrytype' => $this->_request->getParam('fgaccountentrytype'), 'cdsupply' => $this->_request->getParam('cdsupply'), 'fgaccountcheck' => $this->_request->getParam('fgaccountcheck'), 'dtdeadline' => $dtdeadline, 'vlinvoicevalue' => $this->_request->getParam('vlinvoicevalue'), 'idinvoiceref' => $this->_request->getParam('idinvoiceref'), 'dttransactiondate' => $dttransactiondate, 'dtentrydate' => $dtentrydate, 'dtinvoicedate' => $dtinvoicedate, 'dsaccountentrydescription' => $this->_request->getParam('dsaccountentrydescription'), 'fgclienttype' => $this->_request->getParam('fgclienttype'));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $paramAccountcheck = array('cdusergslab' => $this->_request->getParam('cdusergslab'), 'dtaccountcheckdate' => $dtaccountcheckdate, 'vlaccountcheckvalue' => $this->_request->getParam('vlaccountcheckvalue'), 'vltotaltaxvalue' => $this->_request->getParam('vltotaltaxvalue'), 'vlnetvalue' => $this->_request->getParam('vlnetvalue'));
     //update
     if ($this->_request->getParam('cdaccountentry') != '' && $this->_request->getParam('fgaccountcheck') == '0') {
         $this->_model->update($paramAccountentry, 'cdaccountentry = ' . $this->_request->getParam('cdaccountentry'));
         $cdaccountcheck = $AccountCheckModel->insert($paramAccountcheck);
         $AccountCheckModel->getAdapter()->commit();
         $message = "Baixa realizada com sucesso";
     } else {
         if ($this->_request->getParam('cdaccountentry') != '' && $this->_request->getParam('fgaccountcheck') == '1') {
             $this->_model->update($paramAccountentry, 'cdaccountentry = ' . $this->_request->getParam('cdaccountentry'));
             $cdaccountcheck = $AccountCheckModel->insert($paramAccountcheck);
             $AccountCheckModel->getAdapter()->commit();
             $paramentrycheckArray = array('cdaccountentry' => $this->_request->getParam('cdaccountentry'), 'cdaccountcheck' => $cdaccountcheck);
             $accountentrycheckModel->getAdapter()->beginTransaction();
             $accountentrycheckModel->insert($paramentrycheckArray);
             $accountentrycheckModel->getAdapter()->commit();
             $message = "Baixa realizada com sucesso";
         } else {
             if ($this->_request->getParam('cdaccountentry') == '' && $this->_request->getParam('fgaccountcheck') == '0') {
                 $AccountEntryModel->insert($paramAccountentry);
                 $message = "Cadastro efetuado com sucesso";
                 $AccountEntryModel->getAdapter()->commit();
             } else {
                 if ($this->_request->getParam('cdaccountentry') == '' && $this->_request->getParam('fgaccountcheck') == '1') {
                     $cdaccountentry = $this->_model->insert($paramAccountentry);
                     $cdaccountcheck = $AccountCheckModel->insert($paramAccountcheck);
                     $message = "Cadastro efetuado com sucesso";
                     $this->_model->getAdapter()->commit();
                     $AccountCheckModel->getAdapter()->beginTransaction();
                     $AccountCheckModel->getAdapter()->commit();
                     $paramentrycheckArray = array('cdaccountentry' => $cdaccountentry, 'cdaccountcheck' => $cdaccountcheck);
                     $accountentrycheckModel->getAdapter()->beginTransaction();
                     $accountentrycheckModel->insert($paramentrycheckArray);
                     $accountentrycheckModel->getAdapter()->commit();
                 }
             }
         }
     }
     $this->view->message = $message;
 }