public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('creditcarddetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'creditcarddetails';
             $creditcardDetailsform = new Default_Form_Creditcarddetails();
             $creditcardDetailsModel = new Default_Model_Creditcarddetails();
             $creditcardDetailsform->removeElement("submit");
             $elements = $creditcardDetailsform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             $data = $creditcardDetailsModel->getcreditcarddetailsRecord($id);
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $empdata = $employeeModal->getsingleEmployeeData($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             if (!empty($data)) {
                                 $creditcardDetailsform->setDefault("id", $data[0]['id']);
                                 $creditcardDetailsform->setDefault('user_id', $data[0]['user_id']);
                                 $creditcardDetailsform->setDefault("card_type", $data[0]["card_type"]);
                                 $creditcardDetailsform->setDefault("card_number", $data[0]["card_number"]);
                                 $creditcardDetailsform->setDefault("nameoncard", $data[0]["nameoncard"]);
                                 $expiry_date = sapp_Global::change_date($data[0]["card_expiration"], 'view');
                                 $creditcardDetailsform->setDefault('card_expiration', $expiry_date);
                                 $creditcardDetailsform->setDefault("card_issuedby", $data[0]["card_issued_comp"]);
                                 $creditcardDetailsform->setDefault("card_code", $data[0]["card_code"]);
                             }
                             $this->view->controllername = $objName;
                             $this->view->id = $id;
                             if (!empty($empdata)) {
                                 $this->view->employeedata = $empdata[0];
                             } else {
                                 $this->view->employeedata = $empdata;
                             }
                             $this->view->form = $creditcardDetailsform;
                             $this->view->data = $data;
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function creditcardAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('creditcarddetails', $empOrganizationTabs)) {
             $tabName = "creditcard";
             $employeeData = array();
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $loginUserId;
             $employeeModal = new Default_Model_Employee();
             $empdata = $employeeModal->getsingleEmployeeData($id);
             if ($empdata == 'norows') {
                 $this->view->rowexist = "norows";
                 $this->view->empdata = "";
             } else {
                 $this->view->rowexist = "rows";
                 if (!empty($empdata)) {
                     $creditcardDetailsform = new Default_Form_Creditcarddetails();
                     $creditcardDetailsModel = new Default_Model_Creditcarddetails();
                     if ($id) {
                         $data = $creditcardDetailsModel->getcreditcarddetailsRecord($id);
                         if (!empty($data)) {
                             $creditcardDetailsform->setDefault("id", $data[0]["id"]);
                             $creditcardDetailsform->setDefault("user_id", $data[0]["user_id"]);
                             $creditcardDetailsform->setDefault("card_type", $data[0]["card_type"]);
                             $creditcardDetailsform->setDefault("card_number", $data[0]["card_number"]);
                             $creditcardDetailsform->setDefault("nameoncard", $data[0]["nameoncard"]);
                             $expiry_date = sapp_Global::change_date($data[0]["card_expiration"], 'view');
                             $creditcardDetailsform->setDefault('card_expiration', $expiry_date);
                             $creditcardDetailsform->setDefault("card_issuedby", $data[0]["card_issued_comp"]);
                             $creditcardDetailsform->setDefault("card_code", $data[0]["card_code"]);
                         }
                         $creditcardDetailsform->setAttrib('action', DOMAIN . 'mydetails/creditcard/');
                         $this->view->id = $id;
                         $this->view->form = $creditcardDetailsform;
                         $this->view->data = $data;
                     }
                     if ($this->getRequest()->getPost()) {
                         $result = $this->save($creditcardDetailsform, $tabName);
                         $this->view->msgarray = $result;
                     }
                 }
                 $this->view->empdata = $empdata;
                 $this->view->messages = $this->_helper->flashMessenger->getMessages();
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }