public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Jobs'])) {
         $messages = $this->ValidateData(array(array($_POST['Jobs']['orgstructureid'], 'emptyorgstructure', 'emptystring'), array($_POST['Jobs']['jobdesc'], 'emptyjobdesc', 'emptystring'), array($_POST['Jobs']['qualification'], 'emptyqualification', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Absstatus'];
             if ((int) $_POST['Jobs']['jobsid'] > 0) {
                 $model = $this->loadModel($_POST['Jobs']['jobsid']);
                 $model->orgstructureid = $_POST['Jobs']['orgstructureid'];
                 $model->positionid = $_POST['Jobs']['positionid'];
                 $model->jobdesc = $_POST['Jobs']['jobdesc'];
                 $model->qualification = $_POST['Jobs']['qualification'];
                 $model->recordstatus = $_POST['Jobs']['recordstatus'];
             } else {
                 $model = new Jobs();
                 $model->attributes = $_POST['Jobs'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Jobs']['jobsid']);
                     $this->GetSMessage('homjoinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Absstatus'])) {
         $messages = $this->ValidateData(array(array($_POST['Absstatus']['shortstat'], 'emptyshortstat', 'emptystring'), array($_POST['Absstatus']['longstat'], 'hrtasemptylongstat', 'emptystring'), array($_POST['Absstatus']['priority'], 'hrtasemptypriority', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Absstatus'];
             if ((int) $_POST['Absstatus']['absstatusid'] > 0) {
                 $model = $this->loadModel($_POST['Absstatus']['absstatusid']);
                 $model->shortstat = $_POST['Absstatus']['shortstat'];
                 $model->longstat = $_POST['Absstatus']['longstat'];
                 $model->isin = $_POST['Absstatus']['isin'];
                 $model->priority = $_POST['Absstatus']['priority'];
                 $model->recordstatus = $_POST['Absstatus']['recordstatus'];
             } else {
                 $model = new Absstatus();
                 $model->attributes = $_POST['Absstatus'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Absstatus']['absstatusid']);
                     $this->GetSMessage('hrtasinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Maritalstatus'])) {
         $messages = $this->ValidateData(array(array($_POST['Maritalstatus']['maritalstatusname'], 'emptymaritalstatusname', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Maritalstatus'];
             if ((int) $_POST['Maritalstatus']['maritalstatusid'] > 0) {
                 $model = $this->loadModel($_POST['Maritalstatus']['maritalstatusid']);
                 $model->maritalstatusname = $_POST['Maritalstatus']['maritalstatusname'];
                 $model->recordstatus = $_POST['Maritalstatus']['recordstatus'];
             } else {
                 $model = new Maritalstatus();
                 $model->attributes = $_POST['Maritalstatus'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Maritalstatus']['maritalstatusid']);
                     $this->GetSMessage('hmmsinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Onleavetype'])) {
         $messages = $this->ValidateData(array(array($_POST['Onleavetype']['onleavename'], 'emptyonleavename', 'emptystring'), array($_POST['Onleavetype']['cutimax'], 'emptycutimax', 'emptystring'), array($_POST['Onleavetype']['cutistart'], 'emptycustistart', 'emptystring'), array($_POST['Onleavetype']['snroid'], 'emptysnro', 'emptystring'), array($_POST['Onleavetype']['absstatusid'], 'emptyabstatus', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Onleavetype'];
             if ((int) $_POST['Onleavetype']['onleavetypeid'] > 0) {
                 $model = $this->loadModel($_POST['Onleavetype']['onleavetypeid']);
                 $model->onleavename = $_POST['Onleavetype']['onleavename'];
                 $model->snroid = $_POST['Onleavetype']['snroid'];
                 $model->absstatusid = $_POST['Onleavetype']['absstatusid'];
                 $model->cutimax = $_POST['Onleavetype']['cutimax'];
                 $model->cutistart = $_POST['Onleavetype']['cutistart'];
                 $model->recordstatus = $_POST['Onleavetype']['recordstatus'];
             } else {
                 $model = new Onleavetype();
                 $model->attributes = $_POST['Onleavetype'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Onleavetype']['onleavetypeid']);
                     $this->GetSMessage('hpaoltinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Company'])) {
         $messages = $this->ValidateData(array(array($_POST['Company']['companyname'], 'emptycompanyname', 'emptystring'), array($_POST['Company']['address'], 'emptyaddressname', 'emptystring'), array($_POST['Company']['cityid'], 'emptycityname', 'emptystring'), array($_POST['Company']['zipcode'], 'emptyzipcode', 'emptystring'), array($_POST['Company']['currencyid'], 'emptycurrency', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Company']['companyid'] > 0) {
                 $model = $this->loadModel($_POST['Company']['companyid']);
                 $model->companyname = $_POST['Company']['companyname'];
                 $model->address = $_POST['Company']['address'];
                 $model->cityid = $_POST['Company']['cityid'];
                 $model->zipcode = $_POST['Company']['zipcode'];
                 $model->taxno = $_POST['Company']['taxno'];
                 $model->currencyid = $_POST['Company']['currencyid'];
                 $model->recordstatus = $_POST['Company']['recordstatus'];
             } else {
                 $model = new Company();
                 $model->attributes = $_POST['Company'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Company']['companyid']);
                     $this->GetSMessage('scoinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Parameter'])) {
         $messages = $this->ValidateData(array(array($_POST['Parameter']['paramname'], 'emptyparamname', 'emptystring'), array($_POST['Parameter']['paramvalue'], 'emptyparamvalue', 'emptystring'), array($_POST['Parameter']['description'], 'emptydescription', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Parameter']['parameterid'] > 0) {
                 $model = $this->loadModel($_POST['Parameter']['parameterid']);
                 $model->paramname = $_POST['Parameter']['paramname'];
                 $model->paramvalue = $_POST['Parameter']['paramvalue'];
                 $model->description = $_POST['Parameter']['description'];
                 $model->recordstatus = $_POST['Parameter']['recordstatus'];
             } else {
                 $model = new Parameter();
                 $model->attributes = $_POST['Parameter'];
             }
             try {
                 if ($model->save()) {
                     $this->GetSMessage('spinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Snro'])) {
         $messages = $this->ValidateData(array(array($_POST['Snro']['description'], 'emptydescription', 'emptystring'), array($_POST['Snro']['formatdoc'], 'emptyformatdoc', 'emptystring'), array($_POST['Snro']['formatno'], 'emptyformatno', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Snro'];
             if ((int) $_POST['Snro']['snroid'] > 0) {
                 $model = $this->loadModel($_POST['Snro']['snroid']);
                 $model->description = $_POST['Snro']['description'];
                 $model->formatdoc = $_POST['Snro']['formatdoc'];
                 $model->formatno = $_POST['Snro']['formatno'];
                 $model->repeatby = $_POST['Snro']['repeatby'];
                 $model->recordstatus = $_POST['Snro']['recordstatus'];
             } else {
                 $model = new Snro();
                 $model->attributes = $_POST['Snro'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Snro']['snroid']);
                     $this->GetSMessage('agjinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Catalogsys'])) {
         $messages = $this->ValidateData(array(array($_POST['Catalogsys']['languageid'], 'sctemptylanguage', 'emptystring'), array($_POST['Catalogsys']['catalogname'], 'sctemptycatalogname', 'emptystring'), array($_POST['Catalogsys']['catalogval'], 'sctemptycatalogval', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Absstatus'];
             if ((int) $_POST['Catalogsys']['catalogsysid'] > 0) {
                 $model = $this->loadModel($_POST['Catalogsys']['catalogsysid']);
                 $model->languageid = $_POST['Catalogsys']['languageid'];
                 $model->catalogname = $_POST['Catalogsys']['catalogname'];
                 $model->catalogval = $_POST['Catalogsys']['catalogval'];
                 $model->recordstatus = $_POST['Catalogsys']['recordstatus'];
             } else {
                 $model = new Catalogsys();
                 $model->attributes = $_POST['Catalogsys'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Catalogsys']['catalogsysid']);
                     $this->GetSMessage('sctinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Groupmenuauth'])) {
         $messages = $this->ValidateData(array(array($_POST['Groupmenuauth']['groupaccessid'], 'emptygroupname', 'emptystring'), array($_POST['Groupmenuauth']['menuauthidid'], 'emptymenuauth', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Groupmenuauth'];
             if ((int) $_POST['Groupmenuauth']['groupmenuid'] > 0) {
                 $model = $this->loadModel($_POST['Groupmenuauth']['groupmenuid']);
                 $model->groupaccessid = $_POST['Groupmenuauth']['groupaccessid'];
                 $model->menuaccessid = $_POST['Groupmenuauth']['menuaccessid'];
                 $model->isread = $_POST['Groupmenuauth']['isread'];
                 $model->iswrite = $_POST['Groupmenuauth']['iswrite'];
                 $model->ispost = $_POST['Groupmenuauth']['ispost'];
                 $model->isreject = $_POST['Groupmenuauth']['isreject'];
                 $model->isupload = $_POST['Groupmenuauth']['isupload'];
                 $model->isdownload = $_POST['Groupmenuauth']['isdownload'];
             } else {
                 $model = new Groupmenuauth();
                 $model->attributes = $_POST['Groupmenuauth'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Groupmenuauth']['groupmenuid']);
                     $this->GetSMessage('sogmnsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Paymentmethod'])) {
         $messages = $this->ValidateData(array(array($_POST['Paymentmethod']['paycode'], 'aapemptypaycode', 'emptystring'), array($_POST['Paymentmethod']['paymentname'], 'aapemptypaymentname', 'emptystring'), array($_POST['Paymentmethod']['paydays'], 'aapemptypaydays', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Paymentmethod'];
             if ((int) $_POST['Paymentmethod']['paymentmethodid'] > 0) {
                 $model = $this->loadModel($_POST['Paymentmethod']['paymentmethodid']);
                 $model->paycode = $_POST['Paymentmethod']['paycode'];
                 $model->paymentname = $_POST['Paymentmethod']['paymentname'];
                 $model->paydays = $_POST['Paymentmethod']['paydays'];
                 $model->recordstatus = $_POST['Paymentmethod']['recordstatus'];
             } else {
                 $model = new Paymentmethod();
                 $model->attributes = $_POST['Paymentmethod'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Paymentmethod']['paymentmethodid']);
                     $this->GetSMessage('aapinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Splettertype'])) {
         $messages = $this->ValidateData(array(array($_POST['Splettertype']['splettername'], 'hmsptemptysplettername', 'emptystring'), array($_POST['Splettertype']['description'], 'hmsptemptydescription', 'emptystring'), array($_POST['Splettertype']['validperiod'], 'hmsptemptyvalidperiod', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Splettertype'];
             if ((int) $_POST['Splettertype']['splettertypeid'] > 0) {
                 $model = $this->loadModel($_POST['Splettertype']['splettertypeid']);
                 $model->splettername = $_POST['Splettertype']['splettername'];
                 $model->description = $_POST['Splettertype']['description'];
                 $model->validperiod = $_POST['Splettertype']['validperiod'];
                 $model->recordstatus = $_POST['Splettertype']['recordstatus'];
             } else {
                 $model = new Splettertype();
                 $model->attributes = $_POST['Splettertype'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Splettertype']['splettertypeid']);
                     $this->GetSMessage('hrmbtinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Subdistrict'])) {
         $messages = $this->ValidateData(array(array($_POST['Subdistrict']['cityid'], 'emptycityname', 'emptystring'), array($_POST['Subdistrict']['subdistrictname'], 'emptysubdistrict', 'emptystring'), array($_POST['Subdistrict']['zipcode'], 'emptyzipcode', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Subdistrict'];
             if ((int) $_POST['Subdistrict']['subdistrictid'] > 0) {
                 $model = $this->loadModel($_POST['Subdistrict']['subdistrictid']);
                 $model->cityid = $_POST['Subdistrict']['cityid'];
                 $model->subdistrictname = $_POST['Subdistrict']['subdistrictname'];
                 $model->zipcode = $_POST['Subdistrict']['zipcode'];
                 $model->recordstatus = $_POST['Subdistrict']['recordstatus'];
             } else {
                 $model = new Subdistrict();
                 $model->attributes = $_POST['Subdistrict'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Subdistrict']['subdistrictid']);
                     $this->GetSMessage('ccsdinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Menuauth'])) {
         $messages = $this->ValidateData(array(array($_POST['Menuauth']['menuaccessid'], 'emptymenuname', 'emptystring'), array($_POST['Menuauth']['menuobject'], 'emptymenuobject', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Menuauth']['menuauthid'] > 0) {
                 $model = $this->loadModel($_POST['Menuauth']['menuauthid']);
                 $model->menuaccessid = $_POST['Menuauth']['menuaccessid'];
                 $model->menuobject = $_POST['Menuauth']['menuobject'];
                 $model->recordstatus = $_POST['Menuauth']['recordstatus'];
             } else {
                 $model = new Menuauth();
                 $model->attributes = $_POST['Menuauth'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Menuauth']['menuauthid']);
                     $this->GetSMessage('sumansertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Romawi'])) {
         $messages = $this->ValidateData(array(array($_POST['Romawi']['monthcal'], 'emptycalendarmonth', 'emptystring'), array($_POST['Romawi']['monthrm'], 'emptyromemonth', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Romawi'];
             if ((int) $_POST['Romawi']['romawiid'] > 0) {
                 $model = $this->loadModel($_POST['Romawi']['romawiid']);
                 $model->monthcal = $_POST['Romawi']['monthcal'];
                 $model->monthrm = $_POST['Romawi']['monthrm'];
                 $model->recordstatus = $_POST['Romawi']['recordstatus'];
             } else {
                 $model = new Romawi();
                 $model->attributes = $_POST['Romawi'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Romawi']['romawiid']);
                     $this->GetSMessage('croinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Purchasinggroup'])) {
         $messages = $this->ValidateData(array(array($_POST['Purchasinggroup']['purchasingorgid'], 'emptypurchasingorg', 'emptystring'), array($_POST['Purchasinggroup']['purchasinggroupcode'], 'emptypurchasinggroupcode', 'emptystring'), array($_POST['Purchasinggroup']['description'], 'emptydescription', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Purchasinggroup'];
             if ((int) $_POST['Purchasinggroup']['purchasinggroupid'] > 0) {
                 $model = $this->loadModel($_POST['Purchasinggroup']['purchasinggroupid']);
                 $model->purchasinggroupcode = $_POST['Purchasinggroup']['purchasinggroupcode'];
                 $model->purchasingorgid = $_POST['Purchasinggroup']['purchasingorgid'];
                 $model->description = $_POST['Purchasinggroup']['description'];
                 $model->recordstatus = $_POST['Purchasinggroup']['recordstatus'];
             } else {
                 $model = new Purchasinggroup();
                 $model->attributes = $_POST['Purchasinggroup'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Purchasinggroup']['purchasinggroupid']);
                     $this->GetSMessage('ppginsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Unitofmeasure'])) {
         $messages = $this->ValidateData(array(array($_POST['Unitofmeasure']['uomcode'], 'emptyuomcode', 'emptystring'), array($_POST['Unitofmeasure']['description'], 'emptydescription', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Unitofmeasure']['unitofmeasureid'] > 0) {
                 $model = $this->loadModel($_POST['Unitofmeasure']['unitofmeasureid']);
                 $model->uomcode = $_POST['Unitofmeasure']['uomcode'];
                 $model->description = $_POST['Unitofmeasure']['description'];
                 $model->recordstatus = $_POST['Unitofmeasure']['recordstatus'];
             } else {
                 $model = new Unitofmeasure();
                 $model->attributes = $_POST['Unitofmeasure'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Unitofmeasure']['unitofmeasureid']);
                     $this->GetSMessage('iuminsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Snrodet'])) {
         $messages = $this->ValidateData(array(array($_POST['Snrodet']['snroid'], 'emptysnro', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Snrodet'];
             if ((int) $_POST['Snrodet']['snrodid'] > 0) {
                 $model = $this->loadModel($_POST['Snrodet']['snrodid']);
                 $model->snroid = $_POST['Snrodet']['snroid'];
                 $model->curdd = $_POST['Snrodet']['curdd'];
                 $model->curmm = $_POST['Snrodet']['curmm'];
                 $model->curyy = $_POST['Snrodet']['curyy'];
                 $model->curvalue = $_POST['Snrodet']['curvalue'];
             } else {
                 $model = new Snrodet();
                 $model->attributes = $_POST['Snrodet'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Snrodet']['snrodid']);
                     $this->GetSMessage('scoinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Userfav'])) {
         $dataku->attributes = $_POST['Userfav'];
         if ((int) $dataku->attributes['userfavid'] > 0) {
             $model = $this->loadModel($dataku->attributes['userfavid']);
             $model->useraccessid = $dataku->attributes['useraccessid'];
             $model->menuaccessid = $dataku->attributes['menuaccessid'];
         } else {
             $model = new Userfav();
             $model->attributes = $_POST['Userfav'];
         }
         try {
             if ($model->save()) {
                 if (Yii::app()->request->isAjaxRequest) {
                     echo CJSON::encode(array('status' => 'success', 'div' => "Data saved"));
                 }
             } else {
                 $errormessage = $model->getErrors();
                 if (Yii::app()->request->isAjaxRequest) {
                     echo CJSON::encode(array('status' => 'failure', 'div' => $errormessage));
                 }
             }
         } catch (Exception $e) {
             $errormessage = $e->getMessage();
             if (Yii::app()->request->isAjaxRequest) {
                 echo CJSON::encode(array('status' => 'failure', 'div' => $errormessage));
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Useraccess'])) {
         $messages = $this->ValidateData(array(array($_POST['Useraccess']['realname'], 'suaemptyrealname', 'emptystring'), array($_POST['Useraccess']['username'], 'suaemptyusername', 'emptystring'), array($_POST['Useraccess']['email'], 'suaemptyemailname', 'emptystring')));
         if ($messages == '') {
             $oldpass = $_POST['passhide'];
             if ((int) $_POST['Useraccess']['useraccessid'] > 0) {
                 $model = $this->loadModel($_POST['Useraccess']['useraccessid']);
                 $model->username = $_POST['Useraccess']['username'];
                 $model->realname = $_POST['Useraccess']['realname'];
                 $model->password = $model->hashPassword($_POST['Useraccess']['password'], $model->salt);
                 if ($model->password == $oldpass) {
                     $model->password = $oldpass;
                 }
                 $model->email = $_POST['Useraccess']['email'];
                 $model->phoneno = $_POST['Useraccess']['phoneno'];
                 $model->languageid = $_POST['Useraccess']['languageid'];
                 $model->recordstatus = $_POST['Useraccess']['recordstatus'];
             } else {
                 $model = new Useraccess();
                 $model->attributes = $_POST['Useraccess'];
                 $model->salt = $model->generateSalt();
                 $model->password = $model->hashPassword($model->password, $model->salt);
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Useraccess']['useraccessid']);
                     $this->GetSMessage('suainsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Soheader'])) {
         $messages = $this->ValidateData(array());
         if ($messages == '') {
             //$dataku->attributes=$_POST['Soheader'];
             if ((int) $_POST['Soheader']['soheaderid'] > 0) {
                 $model = $this->loadModel($_POST['Soheader']['soheaderid']);
                 $model->addressbookid = $_POST['Soheader']['addressbookid'];
                 $model->paymentmethodid = $_POST['Soheader']['paymentmethodid'];
                 $model->headernote = $_POST['Soheader']['headernote'];
                 $model->sodate = $_POST['Soheader']['sodate'];
             } else {
                 $model = new Soheader();
                 $model->attributes = $_POST['Soheader'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Soheader']['soheaderid']);
                     $this->GetSMessage('mmpoinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Genjournal'])) {
         $messages = $this->ValidateData(array(array($_POST['Genjournal']['journaldate'], 'agjemptyjournaldate', 'emptystring'), array($_POST['Genjournal']['postdate'], 'agjemptypostdate', 'emptystring'), array($_POST['Genjournal']['journalnote'], 'agjemptyjournalnote', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Genjournal'];
             if ((int) $_POST['Genjournal']['genjournalid'] > 0) {
                 $model = $this->loadModel($_POST['Genjournal']['genjournalid']);
                 $model->journaldate = $_POST['Genjournal']['journaldate'];
                 $model->journalnote = $_POST['Genjournal']['journalnote'];
                 $model->postdate = $_POST['Genjournal']['postdate'];
                 $model->referenceno = $_POST['Genjournal']['referenceno'];
             } else {
                 $model = new Genjournal();
                 $model->attributes = $_POST['Genjournal'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Genjournal']['genjournalid']);
                     $this->GetSMessage('agjinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWritecontact()
 {
     parent::actionWrite();
     if (isset($_POST['Insurancecontact'])) {
         $messages = $this->ValidateData(array(array($_POST['Insurancecontact']['contacttypeid'], 'mmpremptycontacttypeid', 'emptystring'), array($_POST['Insurancecontact']['addresscontactname'], 'mmpremptyaddresscontactname', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Insurancecontact']['addresscontactid'] > 0) {
                 $model = Insurancecontact::model()->findbyPK($_POST['Insurancecontact']['addresscontactid']);
                 $model->addressbookid = $_POST['Insurancecontact']['addressbookid'];
                 $model->contacttypeid = $_POST['Insurancecontact']['contacttypeid'];
                 $model->addresscontactname = $_POST['Insurancecontact']['addresscontactname'];
                 $model->phoneno = $_POST['Insurancecontact']['phoneno'];
                 $model->mobilephone = $_POST['Insurancecontact']['mobilephone'];
                 $model->emailaddress = $_POST['Insurancecontact']['emailaddress'];
             } else {
                 $model = new Insurancecontact();
                 $model->attributes = $_POST['Insurancecontact'];
             }
             try {
                 if ($model->save()) {
                     $this->GetSMessage('mmprinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Giheader'])) {
         $messages = $this->ValidateData(array());
         if ($messages == '') {
             //$dataku->attributes=$_POST['Giheader'];
             if ((int) $_POST['Giheader']['giheaderid'] > 0) {
                 $model = $this->loadModel($_POST['Giheader']['giheaderid']);
                 $model->deliveryadviceid = $_POST['Giheader']['deliveryadviceid'];
                 $model->gidate = $_POST['Giheader']['gidate'];
                 $model->location = $_POST['Giheader']['location'];
                 $model->headernote = $_POST['Giheader']['headernote'];
                 $model->soheaderid = $_POST['Giheader']['soheaderid'];
             } else {
                 $model = new Giheader();
                 $model->attributes = $_POST['Giheader'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Giheader']['giheaderid']);
                     $this->GetSMessage('igiinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Purchinforec'])) {
         $messages = $this->ValidateData(array(array($_POST['Purchinforec']['addressbookid'], 'ppiremptyaddressbookid', 'emptystring'), array($_POST['Purchinforec']['productid'], 'ppiremptyproductid', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Purchinforec']['purchinforecid'] > 0) {
                 $model = $this->loadModel($_POST['Purchinforec']['purchinforecid']);
                 $model->addressbookid = $_POST['Purchinforec']['addressbookid'];
                 $model->productid = $_POST['Purchinforec']['productid'];
                 $model->deliverytime = $_POST['Purchinforec']['deliverytime'];
                 $model->purchasinggroupid = $_POST['Purchinforec']['purchasinggroupid'];
                 $model->underdelvtol = $_POST['Purchinforec']['underdelvtol'];
                 $model->overdelvtol = $_POST['Purchinforec']['overdelvtol'];
                 $model->price = $_POST['Purchinforec']['price'];
                 $model->currencyid = $_POST['Purchinforec']['currencyid'];
                 $model->biddate = $_POST['Purchinforec']['biddate'];
             } else {
                 $model = new Purchinforec();
                 $model->attributes = $_POST['Purchinforec'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Purchinforec']['purchinforecid']);
                     $this->GetSMessage('ppirinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Productdetail'])) {
         $messages = $this->ValidateData(array(array($_POST['Productdetail']['productid'], 'mmpdemptyproductid', 'emptystring'), array($_POST['Productdetail']['buydate'], 'mmpdemptybuydate', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Productdetail'];
             if ((int) $_POST['Productdetail']['productdetailid'] > 0) {
                 $model = $this->loadModel($_POST['Productdetail']['productdetailid']);
                 $model->slocid = $_POST['Productdetail']['slocid'];
                 $model->expiredate = $_POST['Productdetail']['expiredate'];
                 $model->serialno = $_POST['Productdetail']['serialno'];
                 $model->qty = $_POST['Productdetail']['qty'];
                 $model->unitofmeasureid = $_POST['Productdetail']['unitofmeasureid'];
                 $model->buydate = $_POST['Productdetail']['buydate'];
                 $model->buyprice = $_POST['Productdetail']['buyprice'];
                 $model->currencyid = $_POST['Productdetail']['currencyid'];
                 $model->picproduct = $_POST['Productdetail']['picproduct'];
                 $model->productid = $_POST['Productdetail']['productid'];
                 $model->materialstatusid = $_POST['Productdetail']['materialstatusid'];
                 $model->location = $_POST['Productdetail']['location'];
                 $model->ownershipid = $_POST['Productdetail']['ownershipid'];
             } else {
                 $model = new Productdetail();
                 $model->attributes = $_POST['Productdetail'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Productdetail']['productdetailid']);
                     $this->GetSMessage('mmpbinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Employeetype'])) {
         $messages = $this->ValidateData(array(array($_POST['Employeetype']['employeetypename'], 'emptyemployeetypename', 'emptystring'), array($_POST['Employeetype']['snroid'], 'emptysnroid', 'emptystring'), array($_POST['Employeetype']['sicksnroid'], 'emptysnroid', 'emptystring'), array($_POST['Employeetype']['sickstatusid'], 'emptysickstatusid', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Employeetype'];
             if ((int) $_POST['Employeetype']['employeetypeid'] > 0) {
                 $model = $this->loadModel($_POST['Employeetype']['employeetypeid']);
                 $model->employeetypename = $_POST['Employeetype']['employeetypename'];
                 $model->snroid = $_POST['Employeetype']['snroid'];
                 $model->sicksnroid = $_POST['Employeetype']['sicksnroid'];
                 $model->sickstatusid = $_POST['Employeetype']['sickstatusid'];
                 $model->recordstatus = $_POST['Employeetype']['recordstatus'];
             } else {
                 $model = new Employeetype();
                 $model->attributes = $_POST['Employeetype'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Employeetype']['employeetypeid']);
                     $this->GetSMessage('hrmetinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Grheader'])) {
         if ((int) $_POST['Grheader']['grheaderid'] > 0) {
             $model = $this->loadModel($_POST['Grheader']['grheaderid']);
             $model->poheaderid = $_POST['Grheader']['poheaderid'];
             $model->giheaderid = $_POST['Grheader']['giheaderid'];
             $model->grdate = $_POST['Grheader']['grdate'];
             $model->headernote = $_POST['Grheader']['headernote'];
         } else {
             $model = new Grheader();
             $model->attributes = $_POST['Grheader'];
         }
         try {
             if ($model->save()) {
                 $this->DeleteLock($this->menuname, $_POST['Grheader']['grheaderid']);
                 $this->GetSMessage('scoinsertsuccess');
             } else {
                 $this->GetMessage($model->getErrors());
             }
         } catch (Exception $e) {
             $this->GetMessage($e->getMessage());
         }
     }
 }
    public function actionWrite()
    {
        parent::actionWrite();
        if (isset($_POST['Employeeschedule'])) {
            $messages = $this->ValidateData(array(array($_POST['Employeeschedule']['employeeid'], 'htesemptyemployeeid', 'emptystring'), array($_POST['Employeeschedule']['month'], 'htesemptymonth', 'emptystring'), array($_POST['Employeeschedule']['year'], 'htesemptyyear', 'emptystring')));
            if ($messages == '') {
                //$dataku->attributes=$_POST['Employeeschedule'];
                if ((int) $_POST['Employeeschedule']['employeescheduleid'] > 0) {
                    $connection = Yii::app()->db;
                    $transaction = $connection->beginTransaction();
                    try {
                        $sql = 'call UpdateEmployeeSchedule(:vemployeescheduleid, :vemployeeid, :vmonth, :vyear,
				:vd1, :vd2, :vd3, :vd4, :vd5, :vd6, :vd7, :vd8, :vd9, :vd10, :vd11,
				:vd12, :vd13, :vd14, :vd15, :vd16, :vd17, :vd18, :vd19, :vd20, :vd21,
				:vd22, :vd23, :vd24, :vd25, :vd26, :vd27, :vd28, :vd29, :vd30, :vd31,
				:vlastupdateby)';
                        $command = $connection->createCommand($sql);
                        $command->bindParam(':vemployeescheduleid', $_POST['Employeeschedule']['employeescheduleid'], PDO::PARAM_INT);
                        $command->bindParam(':vemployeeid', $_POST['Employeeschedule']['employeeid'], PDO::PARAM_INT);
                        $command->bindParam(':vmonth', $_POST['Employeeschedule']['month'], PDO::PARAM_INT);
                        $command->bindParam(':vyear', $_POST['Employeeschedule']['year'], PDO::PARAM_INT);
                        $command->bindParam(':vd1', $_POST['Employeeschedule']['d1'], PDO::PARAM_INT);
                        $command->bindParam(':vd2', $_POST['Employeeschedule']['d2'], PDO::PARAM_INT);
                        $command->bindParam(':vd3', $_POST['Employeeschedule']['d3'], PDO::PARAM_INT);
                        $command->bindParam(':vd4', $_POST['Employeeschedule']['d4'], PDO::PARAM_INT);
                        $command->bindParam(':vd5', $_POST['Employeeschedule']['d5'], PDO::PARAM_INT);
                        $command->bindParam(':vd6', $_POST['Employeeschedule']['d6'], PDO::PARAM_INT);
                        $command->bindParam(':vd7', $_POST['Employeeschedule']['d7'], PDO::PARAM_INT);
                        $command->bindParam(':vd8', $_POST['Employeeschedule']['d8'], PDO::PARAM_INT);
                        $command->bindParam(':vd9', $_POST['Employeeschedule']['d9'], PDO::PARAM_INT);
                        $command->bindParam(':vd10', $_POST['Employeeschedule']['d10'], PDO::PARAM_INT);
                        $command->bindParam(':vd11', $_POST['Employeeschedule']['d11'], PDO::PARAM_INT);
                        $command->bindParam(':vd12', $_POST['Employeeschedule']['d12'], PDO::PARAM_INT);
                        $command->bindParam(':vd13', $_POST['Employeeschedule']['d13'], PDO::PARAM_INT);
                        $command->bindParam(':vd14', $_POST['Employeeschedule']['d14'], PDO::PARAM_INT);
                        $command->bindParam(':vd15', $_POST['Employeeschedule']['d15'], PDO::PARAM_INT);
                        $command->bindParam(':vd16', $_POST['Employeeschedule']['d16'], PDO::PARAM_INT);
                        $command->bindParam(':vd17', $_POST['Employeeschedule']['d17'], PDO::PARAM_INT);
                        $command->bindParam(':vd18', $_POST['Employeeschedule']['d18'], PDO::PARAM_INT);
                        $command->bindParam(':vd19', $_POST['Employeeschedule']['d19'], PDO::PARAM_INT);
                        $command->bindParam(':vd20', $_POST['Employeeschedule']['d20'], PDO::PARAM_INT);
                        $command->bindParam(':vd21', $_POST['Employeeschedule']['d21'], PDO::PARAM_INT);
                        $command->bindParam(':vd22', $_POST['Employeeschedule']['d22'], PDO::PARAM_INT);
                        $command->bindParam(':vd23', $_POST['Employeeschedule']['d23'], PDO::PARAM_INT);
                        $command->bindParam(':vd24', $_POST['Employeeschedule']['d24'], PDO::PARAM_INT);
                        $command->bindParam(':vd25', $_POST['Employeeschedule']['d25'], PDO::PARAM_INT);
                        $command->bindParam(':vd26', $_POST['Employeeschedule']['d26'], PDO::PARAM_INT);
                        $command->bindParam(':vd27', $_POST['Employeeschedule']['d27'], PDO::PARAM_INT);
                        $command->bindParam(':vd28', $_POST['Employeeschedule']['d28'], PDO::PARAM_INT);
                        $command->bindParam(':vd29', $_POST['Employeeschedule']['d29'], PDO::PARAM_INT);
                        $command->bindParam(':vd30', $_POST['Employeeschedule']['d30'], PDO::PARAM_INT);
                        $command->bindParam(':vd31', $_POST['Employeeschedule']['d31'], PDO::PARAM_INT);
                        $post = Useraccess::model()->find("username='******'", array(':postID' => Yii::app()->user->name));
                        $command->bindParam(':vlastupdateby', $post, PDO::PARAM_INT);
                        $command->execute();
                        $transaction->commit();
                        $this->DeleteLock($this->menuname, $_POST['Employeeschedule']['employeescheduleid']);
                        $this->GetSMessage('htesinsertsuccess');
                    } catch (Exception $e) {
                        $transaction->rollBack();
                        $this->GetMessage($e->getMessage());
                    }
                } else {
                    $model = new Employeeschedule();
                    $model->attributes = $_POST['Employeeschedule'];
                    $connection = Yii::app()->db;
                    $transaction = $connection->beginTransaction();
                    try {
                        $sql = 'call InsertEmployeeSchedule(:vemployeeid, :vmonth, :vyear,
				:vd1, :vd2, :vd3, :vd4, :vd5, :vd6, :vd7, :vd8, :vd9, :vd10, :vd11,
				:vd12, :vd13, :vd14, :vd15, :vd16, :vd17, :vd18, :vd19, :vd20, :vd21,
				:vd22, :vd23, :vd24, :vd25, :vd26, :vd27, :vd28, :vd29, :vd30, :vd31,
				:vcreatedby)';
                        $command = $connection->createCommand($sql);
                        $command->bindParam(':vemployeeid', $_POST['Employeeschedule']['employeeid'], PDO::PARAM_INT);
                        $command->bindParam(':vmonth', $_POST['Employeeschedule']['month'], PDO::PARAM_INT);
                        $command->bindParam(':vyear', $_POST['Employeeschedule']['year'], PDO::PARAM_INT);
                        $command->bindParam(':vd1', $_POST['Employeeschedule']['d1'], PDO::PARAM_INT);
                        $command->bindParam(':vd2', $_POST['Employeeschedule']['d2'], PDO::PARAM_INT);
                        $command->bindParam(':vd3', $_POST['Employeeschedule']['d3'], PDO::PARAM_INT);
                        $command->bindParam(':vd4', $_POST['Employeeschedule']['d4'], PDO::PARAM_INT);
                        $command->bindParam(':vd5', $_POST['Employeeschedule']['d5'], PDO::PARAM_INT);
                        $command->bindParam(':vd6', $_POST['Employeeschedule']['d6'], PDO::PARAM_INT);
                        $command->bindParam(':vd7', $_POST['Employeeschedule']['d7'], PDO::PARAM_INT);
                        $command->bindParam(':vd8', $_POST['Employeeschedule']['d8'], PDO::PARAM_INT);
                        $command->bindParam(':vd9', $_POST['Employeeschedule']['d9'], PDO::PARAM_INT);
                        $command->bindParam(':vd10', $_POST['Employeeschedule']['d10'], PDO::PARAM_INT);
                        $command->bindParam(':vd11', $_POST['Employeeschedule']['d11'], PDO::PARAM_INT);
                        $command->bindParam(':vd12', $_POST['Employeeschedule']['d12'], PDO::PARAM_INT);
                        $command->bindParam(':vd13', $_POST['Employeeschedule']['d13'], PDO::PARAM_INT);
                        $command->bindParam(':vd14', $_POST['Employeeschedule']['d14'], PDO::PARAM_INT);
                        $command->bindParam(':vd15', $_POST['Employeeschedule']['d15'], PDO::PARAM_INT);
                        $command->bindParam(':vd16', $_POST['Employeeschedule']['d16'], PDO::PARAM_INT);
                        $command->bindParam(':vd17', $_POST['Employeeschedule']['d17'], PDO::PARAM_INT);
                        $command->bindParam(':vd18', $_POST['Employeeschedule']['d18'], PDO::PARAM_INT);
                        $command->bindParam(':vd19', $_POST['Employeeschedule']['d19'], PDO::PARAM_INT);
                        $command->bindParam(':vd20', $_POST['Employeeschedule']['d20'], PDO::PARAM_INT);
                        $command->bindParam(':vd21', $_POST['Employeeschedule']['d21'], PDO::PARAM_INT);
                        $command->bindParam(':vd22', $_POST['Employeeschedule']['d22'], PDO::PARAM_INT);
                        $command->bindParam(':vd23', $_POST['Employeeschedule']['d23'], PDO::PARAM_INT);
                        $command->bindParam(':vd24', $_POST['Employeeschedule']['d24'], PDO::PARAM_INT);
                        $command->bindParam(':vd25', $_POST['Employeeschedule']['d25'], PDO::PARAM_INT);
                        $command->bindParam(':vd26', $_POST['Employeeschedule']['d26'], PDO::PARAM_INT);
                        $command->bindParam(':vd27', $_POST['Employeeschedule']['d27'], PDO::PARAM_INT);
                        $command->bindParam(':vd28', $_POST['Employeeschedule']['d28'], PDO::PARAM_INT);
                        $command->bindParam(':vd29', $_POST['Employeeschedule']['d29'], PDO::PARAM_INT);
                        $command->bindParam(':vd30', $_POST['Employeeschedule']['d30'], PDO::PARAM_INT);
                        $command->bindParam(':vd31', $_POST['Employeeschedule']['d31'], PDO::PARAM_INT);
                        $post = Useraccess::model()->find("username='******'", array(':postID' => Yii::app()->user->name));
                        $command->bindParam(':vcreatedby', $post, PDO::PARAM_INT);
                        $command->execute();
                        $transaction->commit();
                        $this->DeleteLock($this->menuname, $_POST['Employeeschedule']['employeescheduleid']);
                        $this->GetSMessage('htesinsertsuccess');
                    } catch (Exception $e) {
                        $transaction->rollBack();
                        $this->GetMessage($e->getMessage());
                    }
                }
            }
        }
    }