public function actionCreatecustomers()
 {
     $model = new Customers();
     $model->scenario = "create";
     $datacus = Customers::find()->where('CUST_GRP = CUST_KD')->asArray()->all();
     $parent = ArrayHelper::map($datacus, 'CUST_KD', 'CUST_NM');
     if ($model->load(Yii::$app->request->post())) {
         $post = Yii::$app->request->post();
         $val = $post['Customers']['parentnama'];
         $kdcity = $model->CITY_ID;
         $kdpro = $model->PROVINCE_ID;
         if ($val == 1) {
             $kode = Yii::$app->ambilkonci->getkeycustomers($kdpro, $kdcity);
             $model->CUST_KD = $kode;
             $model->CUST_GRP = $kode;
         } else {
             $kode = Yii::$app->ambilkonci->getkeycustomers($kdpro, $kdcity);
             $model->CUST_KD = $kode;
         }
         // print_r($val);
         // die();
         $tanggal = \Yii::$app->formatter->asDate($model->JOIN_DATE, 'Y-M-d');
         $model->JOIN_DATE = $tanggal;
         if ($model->validate()) {
             $model->CORP_ID = Yii::$app->getUserOpt->Profile_user()->emp->EMP_CORP_ID;
             $model->CREATED_BY = Yii::$app->user->identity->username;
             $model->CREATED_AT = date("Y-m-d H:i:s");
             $model->save();
             return $this->redirect(['esm-index', 'id' => $model->CUST_KD]);
         }
     } else {
         return $this->renderAjax('_formcustomer', ['model' => $model, 'parent' => $parent]);
     }
 }