public function exist($model) { $cari_user = DraftPlanGroup::find()->where(['SCL_NM' => $this->SCDL_GROUP_NM])->one(); if ($cari_user->USER_ID == '') { $this->addError($model, 'User Pada Customers ini Belum Di Setting Group'); } }
/** * Approve using checkbox * place call function _indexMaintainPlan * @author wawan * @since 1.1.0 **/ public function actionApproveAll() { if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $dataKeySelect = $request->post('keysSelect'); foreach ($dataKeySelect as $key => $value) { $model = DraftPlanDetail::find()->where(['LIKE', 'ID', $value])->one(); $scdl_group_nm = $model->SCDL_GROUP_NM; $cus_id = $model->CUST_ID; $cari_user = DraftPlanGroup::find()->where(['SCL_NM' => $scdl_group_nm])->one(); if ($cari_user->USER_ID != '') { $transaction = DraftPlanDetail::getDb()->beginTransaction(); try { self::conn_esm()->createCommand()->update('c0002scdl_plan_detail', ['STATUS' => 1], 'CUST_ID LIKE"' . $cus_id . '" AND STATUS = 0')->execute(); self::conn_esm()->createCommand()->update('c0002scdl_plan_header', ['STATUS' => 1, 'USER_ID' => $cari_user->USER_ID], 'NOTE="' . $scdl_group_nm . '" AND STATUS = 0')->execute(); self::conn_esm()->createCommand()->update('c0002scdl_plan', ['STATUS' => 1], 'CUST_KD="' . $cus_id . '" AND STATUS = 0')->execute(); // ...other DB operations... $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); throw $e; } // self::conn_esm()->createCommand()->update('c0002scdl_plan_detail',['STATUS'=>1,'CUST_ID'=>$cus_id],'ID LIKE"'.$value.'" AND STATUS = 0')->execute(); // self::conn_esm()->createCommand()->update('c0002scdl_plan_header',['STATUS'=>1,'USER_ID'=>$cari_user->USER_ID],'NOTE="'.$scdl_group_nm.'" AND STATUS = 0')->execute(); // self::conn_esm()->createCommand()->update('c0002scdl_plan',['STATUS'=>1],'CUST_KD="'.$model->CUST_ID.'" AND STATUS = 0')->execute(); } } return true; } return $this->redirect(['index?tab=1']); }
public function searchEmpty($params) { $query = DraftPlanGroup::find()->where('STATUS=100'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 0]]); return $dataProvider; }
public function getCountuser() { $count = DraftPlanGroup::find()->where(['USER_ID' => $this->USER_ID, 'STATUS' => 1])->count(); return $count; }
use kartik\grid\GridView; use yii\bootstrap\Modal; use lukisongroup\master\models\DraftPlan; use lukisongroup\master\models\DraftPlanGroup; use ptrnov\salesforce\Jadwal; use kartik\widgets\Spinner; $ptr_spiner1 = Spinner::widget(['id' => 'spn-gv-maintain', 'preset' => 'large', 'align' => 'center', 'color' => 'blue', 'hidden' => false]); $actionClass = 'btn btn-info btn-xs'; $actionLabel = 'Update'; $attDinamik = []; /*GRIDVIEW ARRAY FIELD HEAD*/ $headColomn = [['ID' => 0, 'ATTR' => ['FIELD' => 'SCDL_GROUP', 'SIZE' => '10px', 'label' => 'AUTO GROUP', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'grp' => true]], ['ID' => 1, 'ATTR' => ['FIELD' => 'TGL', 'SIZE' => '20px', 'label' => 'DATE', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 2, 'ATTR' => ['FIELD' => 'dayofDate', 'SIZE' => '30px', 'label' => 'DAY.NM', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 3, 'ATTR' => ['FIELD' => 'weekofDate', 'SIZE' => '20px', 'label' => 'WEEK', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 4, 'ATTR' => ['FIELD' => 'custlayernm', 'SIZE' => '10px', 'label' => 'LAYER', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 5, 'ATTR' => ['FIELD' => 'CUST_ID', 'SIZE' => '50px', 'label' => 'CUST.ID', 'align' => 'center', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 6, 'ATTR' => ['FIELD' => 'custNm', 'SIZE' => '200px', 'label' => 'CUSTOMER', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'group' => true]], ['ID' => 7, 'ATTR' => ['FIELD' => 'SalesNm', 'SIZE' => '20px', 'label' => 'SALES.NM', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 8, 'ATTR' => ['FIELD' => 'UseridNm', 'SIZE' => '20px', 'label' => 'USER.ID', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'grp' => false]], ['ID' => 9, 'ATTR' => ['FIELD' => 'STATUS', 'SIZE' => '20px', 'label' => 'Status', 'align' => 'left', 'warna' => '73, 162, 182, 1', 'grp' => false]]]; $gvHeadColomnBT = ArrayHelper::map($headColomn, 'ID', 'ATTR'); $attDinamik[] = ['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(73, 162, 182, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]]; $attDinamik[] = ['class' => '\\kartik\\grid\\CheckboxColumn', 'width' => '10px', 'checkboxOptions' => function ($model, $key, $index, $column) { $check_user = DraftPlanGroup::find()->where(['SCL_NM' => $model->SCDL_GROUP_NM])->one(); if ($check_user->USER_ID == "") { return ['checked' => '', 'hidden' => true]; } elseif ($model->STATUS == 1) { return ['checked' => '', 'hidden' => true]; } }, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(73, 162, 182, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]]; /*GRIDVIEW ARRAY ROWS*/ foreach ($gvHeadColomnBT as $key => $value[]) { if ($value[$key]['FIELD'] == 'STATUS') { $attDinamik[] = ['attribute' => $value[$key]['FIELD'], 'label' => $value[$key]['label'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => $valStt, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Pilih'], 'format' => 'raw', 'value' => function ($model) { if ($model->STATUS == 1) { return Html::a('<i class="fa fa-check"></i> Approve', '', ['class' => 'btn btn-success btn-xs', 'title' => 'Approve']); } else { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-close"></i> DRAFT', '', ['class' => 'btn btn-danger btn-xs', 'title' => 'Deactive']);