/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rodetail::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['ID' => $this->ID, 'QTY' => $this->QTY, 'STATUS' => $this->STATUS, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT]); $query->andFilterWhere(['like', 'KD_RO', $this->KD_RO])->andFilterWhere(['like', 'KD_BARANG', $this->KD_BARANG])->andFilterWhere(['like', 'NM_BARANG', $this->NM_BARANG])->andFilterWhere(['like', 'NO_URUT', $this->NO_URUT])->andFilterWhere(['like', 'NOTE', $this->NOTE]); return $dataProvider; }
public function actionSimpanproses() { //$rodetails = new Rodetail(); $ts = Yii::$app->request->post(); if (count($ts) == 0) { return $this->redirect([' ']); } $kd = $ts['kd']; foreach ($ts['ck'] as $ts) { $rodetail = Rodetail::findOne($ts); $rodetail->STATUS = 1; if ($rodetail->save()) { $reqro = Requestorder::find()->where(['KD_RO' => $kd])->one(); $reqro->STATUS = 1; $reqro->save(); } } return $this->redirect(['proses', 'kd' => $kd]); // $rodetail->save(); }
?> <!-- Stack the columns on mobile by making one full-width and the other half-width --> <div class="row"> <?php if ($quer->STATUS != 102) { if ($kr == 'HR-02') { ?> <div class="col-xs-12 col-md-3"> <?php Pjax::begin(['id' => 'pjax-users']); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['KD_RO', ['format' => 'raw', 'value' => function ($data) { $count = Rodetail::find()->where(['KD_RO' => $data->KD_RO])->count(); if (!empty($count)) { return Html::a('<button type="button" class="btn btn-primary btn-xs">View</button>', ['detail', 'kd_ro' => $data->KD_RO, 'kdpo' => $_GET['kdpo']], ['data-toggle' => "modal", 'data-target' => "#myModal", 'data-title' => $data->KD_RO]); // ubah ini } else { return '<button type="button" class="btn btn-danger btn-xs">No Data</button>'; } }]]]); ?> <?php Pjax::end(); ?> <?php $this->registerJs("\n\t\t \$('#myModal').on('show.bs.modal', function (event) {\n\t\t var button = \$(event.relatedTarget)\n\t\t var modal = \$(this)\n\t\t var title = button.data('title') \n\t\t var href = button.attr('href') \n\t\t modal.find('.modal-title').html(title)\n\t\t modal.find('.modal-body').html('<i class=\"fa fa-spinner fa-spin\"></i>')\n\t\t \$.post(href)\n\t\t .done(function( data ) {\n\t\t modal.find('.modal-body').html(data)\n\t\t });\n\t\t })\n\t\t"); Modal::begin(['id' => 'myModal', 'header' => '<h4 class="modal-title">...</h4>']);
public function actionDetail($kd_ro, $kdpo) { /* $searchModel = new RodetailSearch([ 'KD_RO' => $kd_ro, // Tambahkan ini 'STATUS' => 1 // Tambahkan ini ]); */ // $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $podet = Rodetail::find()->where(['KD_RO' => $kd_ro, 'STATUS' => 1])->all(); return $this->renderAjax('_detail', ['po' => $podet, 'kdpo' => $kdpo, 'kd_ro' => $kd_ro]); }
public function actionDetail($kd_ro, $kdpo) { $podet = Rodetail::find()->where(['KD_RO' => $kd_ro, 'STATUS' => 1])->all(); return $this->renderAjax('_detail', ['po' => $podet, 'kdpo' => $kdpo, 'kd_ro' => $kd_ro]); }
<div class="col-xs-6"> <?php echo Html::submitButton('<i class="fa fa-floppy-o fa-fw"></i> Simpan', ['class' => 'btn btn-success']); ?> <?php echo Html::a('<i class="fa fa-print fa-fw"></i> Cetak', ['cetakpdf', 'kd' => $id], ['target' => '_blank', 'class' => 'btn btn-warning']); ?> </div> </div> <?php ActiveForm::end(); ?> <?php $que = Rodetail::find()->where(['KD_RO' => $id])->andWhere('STATUS <> 3'); echo "<br/><br/>"; $dataProvider = new ActiveDataProvider(['query' => $que]); echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['NM_BARANG', 'QTY', 'UNIT', 'NOTE', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{hapus}', 'buttons' => ['hapus' => function ($model, $key) { if ($key->STATUS == 0) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['hapus', 'kode' => $_GET['id'], 'id' => $key->ID], ['data-confirm' => 'Anda yakin ingin menghapus barang ini?', 'title' => 'Hapus']); } }]]]]); /* 'dataProvider'=> $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumns, 'responsive'=>true, 'hover'=>true ]);*/ ?>
/** * Finds the Rodetail model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Rodetail the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Rodetail::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getDetro() { return $this->hasMany(Rodetail::className(), ['KD_RO' => 'KD_RO']); }
<div class="requestorder-index" style="padding:10px;"> <h1><?php echo Html::encode($this->title); ?> </h1> <hr/> <?php $empId = Yii::$app->user->identity->EMP_ID; $dt = Employe::find()->where(['EMP_ID' => $empId])->all(); $jbtan = $dt[0]['JOBGRADE_ID']; $gridColumns = [['class' => 'yii\\grid\\SerialColumn'], 'KD_RO', 'nmemp', 'KD_CORP', ['format' => 'raw', 'value' => function ($model) { $rodetail = new Rodetail(); $dt = Rodetail::find()->where(['KD_RO' => $model->KD_RO])->andWhere('STATUS <> 3')->count(); $cn = Rodetail::find()->where(['KD_RO' => $model->KD_RO, 'STATUS' => 1])->count(); if ($model->STATUS == 1) { return Html::a('<i class="fa fa-check"></i> ' . $cn . ' Dari ' . $dt, ['proses', 'kd' => $model->KD_RO], ['class' => 'btn btn-success btn-sm', 'title' => 'Detail']); } else { if ($model->STATUS == 0) { return Html::a('<i class="fa fa-navicon"></i> Proses', ['proses', 'kd' => $model->KD_RO], ['class' => 'btn btn-danger btn-sm', 'title' => 'Detail']); } } }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{link} {edit} {delete} {cetak}', 'buttons' => ['link' => function ($url, $model) { return Html::a('', ['view', 'kd' => $model->KD_RO], ['class' => 'fa fa-info-circle fa-lg', 'title' => 'Detail']); }, 'edit' => function ($url, $model) { return Html::a('', ['buatro', 'id' => $model->KD_RO], ['class' => 'fa fa-pencil-square-o fa-lg', 'title' => 'Ubah RO']); }, 'delete' => function ($url, $model) { if ($model->STATUS == 0) { return Html::a('', ['hapusro', 'id' => $model->KD_RO], ['class' => 'fa fa-trash-o fa-lg', 'title' => 'Hapus RO', 'data-confirm' => 'Anda yakin ingin menghapus RO ini?']); }