use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel backend\models\accounting\search\PaymentMethod */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Payment Methods'; $this->params['breadcrumbs'][] = $this->title; ?> <p class='pull-right'> <?php echo Html::a('Create Payment Method', ['create'], ['class' => 'btn btn-default']); ?> </p> <br> <div class="payment-method-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'branch_id', 'label' => 'Branch', 'value' => 'branch.name', 'filter' => backend\models\master\Branch::selectOptions()], ['label' => 'Paymnt Method', 'attribute' => 'method'], ['label' => 'Target Account', 'value' => function ($model) { return $model->coa->code . ' - ' . $model->coa->name; }], ['label' => 'Potongan', 'value' => function ($model) { return $model->potongan > 0 ? $model->potongan * 100 . '%' : '-'; }], ['label' => 'Target Account Potongan', 'value' => function ($model) { return $model->coaPotongan !== null ? $model->coaPotongan->code . ' - ' . $model->coaPotongan->name : '-'; }], 'created_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model backend\models\accounting\PaymentMethod */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="payment-method-form col-lg-6"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'branch_id')->dropDownList(backend\models\master\Branch::selectOptions(), ['style' => 'width:30%;']); ?> <?php echo $form->field($model, 'method')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'coa_id')->dropDownList(backend\models\accounting\Coa::selectOptions(), ['style' => 'width:80%;']); ?> <?php echo $form->field($model, 'potongan')->textInput(['maxlength' => true, 'style' => 'width:30%;'])->label('Nilai Potongan'); ?> <?php