private function loadComponents()
 {
     $resAjax = new Response_Ajax();
     $arrType = array('TIPO_IDENT', 'ESTADO_CIVIL', 'GENDER', 'TIPO_DE_SANGRE');
     try {
         $oBus = Business_App_Catalog::listByType($arrType);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $oBus1 = Business_App_Profile::listProfile('', NULL, NULL);
         $dataCatalogo = $oBus->data();
         $eCatalogs = $dataCatalogo['eCatalogs'];
         $dataProfile = $oBus1->data();
         $eProfiles = $dataProfile['eProfiles'];
         $eProfiles = Helper_Array::entitiesToIdText($eProfiles, 'id', 'name', 'value', 'text');
         $oBus2 = Business_App_Company_Branch::listByCompany(Helper_App_Session::getCompanyId(), 1);
         $dataCompanyBranch = $oBus2->data();
         $eCompanyBranches = $dataCompanyBranch['eCompanyBranchs'];
         $eCompanyBranches = Helper_Array::entitiesToIdText($eCompanyBranches, 'id', 'name', 'value', 'text');
         $resAjax->isSuccess(TRUE);
     } catch (Exception $e) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($e->getMessage());
     }
     $resAjax->data(array('eCatalogs' => $eCatalogs, 'eProfiles' => $eProfiles, 'eCompanyBranches' => $eCompanyBranches));
     echo $resAjax->toJsonEncode();
 }
 private function saveCompanyBranch()
 {
     $this->load->file('application/modules/app/utility_company_and_company_branch/form/company_branch_form.php');
     $resAjax = new Response_Ajax();
     $frm_data = new Form_App_Company_Branch(TRUE);
     try {
         if (!$this->permission->update_branch) {
             throw new Exception('No tiene permisos para editar/actualizar');
         }
         if (!$frm_data->isValid()) {
             throw new Exception('Debe ingresar la información en todos los campos');
         }
         $eCompanyBranch = $frm_data->getCompanyBranchEntity();
         $eCompanyBranch->id_company = Helper_App_Session::getCompanyId();
         $oBus = Business_App_Company_Branch::saveCompanyBranch($eCompanyBranch);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('company_branch', $frm_data->toArray());
     }
     echo $resAjax->toJsonEncode();
 }