<?php //echo $form->checkboxRow($model,'iscontract'); ?> <?php //echo $form->field($model,'stockAction')->checkbox(); ?> <?php //echo $form->field($model,'account_type')->widget(Select2::classname(), ['data' =>arrayhelper::map(Acctype::find()->All(), 'id', 'name')]); ?> <br /> <?php echo $form->field($model, 'docStatus_id')->widget(Select2::classname(), ['data' => arrayhelper::map(Docstatus::find()->where(array('doc_type' => $model->id))->all(), 'num', 'name')]); ?> <br /> <?php echo $form->field($model, 'last_docnum'); ?> <?php echo $form->field($model, 'header')->textArea(); ?> <?php echo $form->field($model, 'footer')->textArea();
public function getDocStatus() { return $this->hasOne(Docstatus::className(), ['num' => 'status', 'doc_type' => 'doctype']); }
* */ app\widgets\MiniForm::begin(array('header' => Yii::t('app', "Manage Docs"))); ?> <?php \yii\widgets\Pjax::begin(); echo $searchModel->issue_from; $dateisOn = kartik\date\DatePicker::widget(['model' => $searchModel, 'attribute' => 'issue_from', 'attribute2' => 'issue_to', 'removeButton' => false, 'type' => 5, 'separator' => '']); //. //kartik\date\DatePicker::widget([ 'model' => $searchModel, 'attribute' => 'issue_to', 'removeButton' => false, ]); //kartik\datecontrol\DateControl::widget(['model' => $searchModel, 'attribute' => 'issue_to', 'type' => 'date']); $filter = ''; if ($searchModel->doctype != null) { $filter = \yii\helpers\ArrayHelper::map(\app\models\Docstatus::find()->where(['doc_type' => $searchModel->doctype])->All(), 'num', 'name'); } else { //$searchModel->status = null; } echo app\widgets\GridView::widget(array('dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => array(array('attribute' => 'doctype', 'filter' => \app\models\Doctype::tlist(), 'value' => function ($data) { return $data->TypeName(); }, 'width' => '150px'), array('attribute' => 'status', 'filter' => $filter, 'value' => function ($data) { return $data->docStatus->name; }, 'width' => '70px'), array('attribute' => 'refstatus', 'width' => '110px', 'filter' => \yii\helpers\ArrayHelper::map(\app\models\Docs::getRefStatuses(), 'id', 'name'), 'value' => function ($data) { return app\widgets\Switcher::widget(['model' => $data, 'name' => 'refstatus', 'url' => yii\helpers\BaseUrl::base() . '/docs/refstatus/' . $data->id, 'onLabel' => Yii::t('app', 'Open'), 'offLabel' => Yii::t('app', 'Closed')]); }, 'format' => 'raw'), array('attribute' => 'docnum', 'width' => '70px'), array('attribute' => 'account_id', 'width' => '70px'), 'company', 'refnum_ext', array('attribute' => 'issue_date', 'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['convertFormat' => true, 'useWithAddon' => true, 'pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to '], 'hideInput' => true, 'presetDropdown' => false], 'width' => '150px', 'value' => function ($data) { return $data->readDateFormat($data->issue_date); }), 'total', array('options' => array('style' => 'width:95px;'), 'class' => 'yii\\grid\\ActionColumn', 'template' => '{duplicate}{print}{view}{update}{delete}', 'buttons' => array('update' => function ($url, $model, $key) { if ($model->docStatus->looked == 1) { return ''; }
* The Initial Developer of the Original Code is Adam Ben Hur. * All portions are Copyright (C) Adam Ben Hur. * All Rights Reserved. * ********************************************************************************** */ use yii\helpers\Html; use yii\helpers\ArrayHelper; use kartik\select2\Select2; use kartik\datecontrol\DateControl; use app\models\Language; //use kartik\markdown\MarkdownEditor; $form = kartik\form\ActiveForm::begin(array('id' => 'docs-form', 'enableAjaxValidation' => false, 'enableClientValidation' => false, 'validateOnSubmit' => false, 'options' => array('enctype' => 'multipart/form-data'))); $docnum = $model->getMax($model->doctype) != $model->docType->last_docnum; if ($docnum) { \Yii::$app->getSession()->setFlash('danger', Yii::t('app', 'Document exists please fix last_num Value') . " " . Html::a('Here', yii\helpers\BaseUrl::base() . '/doctype/update/' . $model->doctype)); } $docstatus = ArrayHelper::map(\app\models\Docstatus::find()->where(['doc_type' => $model->doctype])->all(), 'num', 'name'); $currncies = ArrayHelper::map(\app\models\Currates::GetRateList(), 'currency_id', 'name'); $accounts = ArrayHelper::map(\app\models\Accounts::findAllByType($model->docType->account_type), 'id', 'name'); if ($model->doctype == 6) { $accounts1 = ArrayHelper::map(\app\models\Accounts::findAllByType(9), 'id', 'name'); $accounts += $accounts1; } $accounts[0] = Yii::t('app', 'None'); $oppts = ArrayHelper::map(\app\models\Accounts::findAllByType($model->docType->oppt_account_type), 'id', 'name'); $oppts[""] = Yii::t('app', 'None'); //echo $form->dropDownList($model, "[$i]item_id", $oppts); $this->registerJs("var baseAddress='" . yii\helpers\BaseUrl::base() . "';" . "var oppt_account_type=" . (int) $model->docType->oppt_account_type . ";", \yii\web\View::POS_HEAD); $this->registerJsFile(yii\helpers\BaseUrl::base() . '/assets/docs.js', ['depends' => [\yii\web\JqueryAsset::className()]]); ?> <div class="form"> <!-- <p class="note">Fields with <span class="required">*</span> are required.</p>-->