/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Pembukuan_type::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(['TYPE_ID' => $this->TYPE_ID]); $query->andFilterWhere(['like', 'TYPE_NM', $this->TYPE_NM]); return $dataProvider; }
return Html::a('<i class="glyphicon glyphicon-ok"></i> proses', '#', ['class' => 'btn btn-success btn-xs', 'style' => ['width' => '100px'], 'title' => 'process']); } elseif ($model->STATUS == 1) { /*closing*/ return Html::a('<i class="fa fa-remove fa-md"></i> Closing', '#', ['class' => 'btn btn-danger btn-xs', 'style' => ['width' => '25px'], 'title' => 'Closing']); } } //$this->title = 'Pembukuans'; //$this->params['breadcrumbs'][] = $this->title; $clmPembukuan = [['class' => 'kartik\\grid\\SerialColumn', 'width' => '10px', 'header' => 'No.', 'hAlign' => 'center', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryOptions' => ['style' => ['border-right' => '0px']]], ['attribute' => 'TGL', 'label' => 'Tanggal', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd', 'autoclose' => true, 'todayHighlight' => true, 'autoWidget' => false]], 'value' => function ($model) { /* * max String Disply * @author ptrnov <*****@*****.**> */ return substr($model->TGL, 0, 10); }, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'TYPE', 'label' => 'Type', 'filter' => $filterTypeNm, 'value' => function ($model) { $nmType = Pembukuan_type::find()->where(['TYPE_ID' => $model->TYPE])->one(); return $nmType != '' ? $nmType->TYPE_NM : 'none'; }, 'noWrap' => false, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'CHILD', 'label' => 'Kategori', 'filter' => $filterChildNm, 'noWrap' => true, 'value' => function ($model) { $nmChild = Pembukuan_child::find()->where(['CHILD_ID' => $model->CHILD])->one(); return $nmChild != '' ? $nmChild->CHILD_NM : 'none'; }, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'SRC', 'noWrap' => false, 'label' => 'State', 'filter' => $valSource, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'SRC_DSC_REF', 'label' => 'Ref.Kode', 'filter' => true, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'SRC_DSC', 'label' => 'Dari', 'filter' => $dataRt, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'SRC_DSC_QTY', 'label' => 'Jumlah', 'hAlign' => 'left', 'vAlign' => 'middle', 'pageSummaryFunc' => GridView::F_SUM, 'pageSummary' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']], 'pageSummaryOptions' => ['style' => ['text-align' => 'right', 'width' => '100px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']]], ['attribute' => 'SRC_DSC_PRICE', 'label' => 'Harga', 'hAlign' => 'left', 'vAlign' => 'middle', 'format' => ['decimal', 2], 'pageSummaryFunc' => GridView::F_SUM, 'pageSummary' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '80px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']], 'pageSummaryOptions' => ['style' => ['text-align' => 'right', 'width' => '100px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']]], ['class' => 'kartik\\grid\\FormulaColumn', 'header' => 'Sub.total', 'mergeHeader' => true, 'vAlign' => 'middle', 'hAlign' => 'right', 'value' => function ($model, $key, $index, $widget) { $p = compact('model', 'key', 'index'); /*Formula Round Unit/harga pcs -ptr.nov-*/ //return $widget->col(6, $p) != 0 ? $widget->col(6, $p) * round($model->UNIT_QTY * $widget->col(8, $p),0,PHP_ROUND_HALF_UP): 0; return $widget->col(7, $p) != 0 ? round($widget->col(7, $p) * $widget->col(8, $p), 0, PHP_ROUND_HALF_UP) : 0; //return $widget->col(3, $p) != 0 ? $widget->col(5 ,$p) * 100 / $widget->col(3, $p) : 0; }, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '150px', 'font-family' => 'tahoma', 'font-size' => '8pt']], 'pageSummaryFunc' => GridView::F_SUM, 'pageSummary' => true, 'format' => ['decimal', 2], 'pageSummaryOptions' => ['style' => ['text-align' => 'right', 'width' => '100px', 'font-family' => 'tahoma', 'font-size' => '8pt', 'border-left' => '0px']], 'footer' => true], ['attribute' => 'SRC_DSC_DETAIL', 'label' => 'Ket.Detail', 'filter' => false, 'noWrap' => true, 'mergeHeader' => true, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '150px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['attribute' => 'STATUS', 'label' => 'Status', 'filter' => $valStatus, 'format' => 'html', 'value' => function ($model, $key, $index, $widget) { return sttPembukuan($model); }, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(0, 95, 218, 0.3)']], 'contentOptions' => ['style' => ['text-align' => 'right', 'width' => '100px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => true, 'template' => '{view}{edit}{delete}', 'dropdownOptions' => ['class' => 'pull-right dropup'], 'buttons' => ['view' => function ($url, $model, $key) { return '<li>' . Html::a('<span class="fa fa-eye fa-dm"></span>' . Yii::t('app', 'View'), ['/dashboard/pembukuan-harian/view', 'id' => $model->ID], ['data-toggle' => "modal", 'data-target' => "#modal-view", 'data-title' => 'RT0' . $model->SRC_DSC_REF]) . '</li>' . PHP_EOL; }, 'edit' => function ($url, $model, $key) {
/** * Finds the Pembukuan_type model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Pembukuan_type the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Pembukuan_type::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use kartik\widgets\Select2; use yii\helpers\ArrayHelper; use yii\helpers\Url; use kartik\widgets\DepDrop; use kartik\widgets\TouchSpin; use ubud\dashboard\models\Pembukuan_type; use ubud\dashboard\models\Pembukuan_child; use ubud\dashboard\models\Pembukuan_golongan; use ubud\dashboard\models\Rt; $filterTypeNm = ArrayHelper::map(Pembukuan_type::find()->all(), 'TYPE_ID', 'TYPE_NM'); $filterChildNm = ArrayHelper::map(Pembukuan_child::find()->where(['SRC' => 'rw11'])->all(), 'CHILD_ID', 'CHILD_NM'); $dataRt = ArrayHelper::map(Rt::find()->all(), 'id_rt', 'ket_rt'); $arySource = [['user_warga' => 'rw11', 'DESCRIP' => 'RW11'], ['user_warga' => 1, 'DESCRIP' => 'RT01'], ['user_warga' => 2, 'DESCRIP' => 'RT02'], ['user_warga' => 3, 'DESCRIP' => 'RT03'], ['user_warga' => 4, 'DESCRIP' => 'RT04']]; $valSource = ArrayHelper::map($arySource, 'user_warga', 'DESCRIP'); $tglSkarang = date('Y-m-d h:i:s'); if (!Yii::$app->user->isGuest) { $idWarga = Yii::$app->user->identity->warga != '' ? Yii::$app->user->identity->warga : 'rw11'; } ?> <div class="pembukuan-form"> <?php $form = ActiveForm::begin(['id' => 'create-lap', 'enableClientValidation' => true]); ?> <?php
public function getBooktype() { return $this->hasOne(Pembukuan_type::className(), ['TYPE_ID' => 'TYPE']); }