/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WarehouseModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'branch_id' => $this->branch_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]); $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
echo Toolbar::widget(['items' => [['label' => '', 'url' => ['print-html'], 'icon' => 'fa fa-print', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Html Print']], ['label' => '', 'url' => ['print-pdf'], 'icon' => 'fa fa-file', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Pdf']], ['label' => '', 'url' => ['print-xsl'], 'icon' => 'fa fa-table', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Excel']]]]) . ' '; echo ActionToolbar::widget(['items' => [['label' => 'Create New', 'url' => ['create'], 'icon' => 'fa fa-plus-square'], ['label' => 'Update', 'url' => ['update', 'id' => $model->id], 'icon' => 'fa fa-pencil'], ['label' => 'Delete', 'url' => ['delete', 'id' => $model->id], 'icon' => 'fa fa-trash-o', 'linkOptions' => ['data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]], ['label' => 'Goods Movement List', 'url' => ['index'], 'icon' => 'fa fa-list']]]); ?> <div class="box box-primary" style="min-height: 160px; margin-bottom: 20px; padding-top: 20px;"> <div class="box-body"> <div class="col-lg-6"> <?php echo $form->field($model, 'number')->textInput(['readonly' => true, 'style' => 'width:30%;']); ?> <?php if (isset($config['branch_field'])) { $branch_id = $model->reffDoc->{$config['branch_field']}; } else { $branch_id = null; } echo $form->field($model, 'warehouse_id')->dropDownList(Warehouse::selectOptions($branch_id)); ?> <?php echo $form->field($model, 'nmStatus')->textInput(['maxlength' => 16, 'readonly' => true, 'style' => 'width:20%;']); ?> </div> <div class="col-lg-6"> <?php echo $form->field($model, 'Date')->widget('yii\\jui\\DatePicker', ['options' => ['class' => 'form-control', 'style' => 'width:150px;']]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => 255]); ?> <div class="form-group field-goodsmovement-number">
?> </div> <div class="tab-pane col-lg-12" id="delivery-pane"> <div class="box box-solid"> <?php // echo ListView::widget([ // 'dataProvider' => $greceipt, // 'layout' => '{items}', // 'itemView' => '_greceipt', // //'options' => ['class' => 'box-body'] // ]); ?> <?php echo yii\grid\GridView::widget(['tableOptions' => ['class' => 'table table-striped'], 'layout' => '{items}', 'dataProvider' => $greceipt, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Receipt Number', 'format' => 'raw', 'value' => function ($data) { return Html::a($data->number, ['inventory/movement/view', 'id' => $data->id]); }], 'date:date', ['attribute' => 'warehouse_id', 'value' => 'warehouse.name', 'filter' => Warehouse::selectOptions()], ['attribute' => 'status', 'format' => 'raw', 'filter' => [GoodsMovement::STATUS_DRAFT => 'Draft', GoodsMovement::STATUS_PROCESS => 'Proccess', GoodsMovement::STATUS_CLOSE => 'Closed'], 'value' => function ($data) { $color = $data->status == GoodsMovement::STATUS_DRAFT ? 'danger' : 'success'; $color = $data->status == GoodsMovement::STATUS_PROCESS ? 'info' : $color; $color = $data->status == GoodsMovement::STATUS_CLOSE ? 'success' : $color; return Html::tag('small', $data->nmStatus, ['class' => 'label label-' . $color]); }]]]); ?> </div> </div> <div class="tab-pane col-lg-12" id="payments-pane"> Payments </div> </div> </div> </section> </div>
use app\models\master\Warehouse; use yii\helpers\ArrayHelper; use app\models\inventory\GoodsMovementDtl; /* @var $this yii\web\View */ /* @var $grModel app\models\inventory\GoodsMovement */ /* @var $model app\models\inventory\Transfer */ /* @var $form yii\widgets\ActiveForm */ $form = ActiveForm::begin(); ?> <div class="box box-warning orgn-form"> <div class="box-body"> <?php echo $form->field($grModel, 'number')->textInput(['readonly' => true]); ?> <?php echo $form->field($grModel, 'warehouse_id')->dropDownList(ArrayHelper::map(Warehouse::find()->all(), 'id', 'name')); ?> <?php echo $form->field($grModel, 'Date')->widget('yii\\jui\\DatePicker', ['options' => ['class' => 'form-control']]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> </div> <div> <?php $grDtls = ArrayHelper::index($grModel->goodsMovementDtls, 'product_id'); $i = 1;
/** * Finds the Warehouse model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Warehouse the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Warehouse::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getWarehouses() { return $this->hasMany(Warehouse::className(), ['branch_id' => 'id']); }
<section class="col-lg-12"> <?php echo Toolbar::widget(['items' => [['label' => '', 'url' => ['print-html'], 'icon' => 'fa fa-print', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Html Print']], ['label' => '', 'url' => ['print-pdf'], 'icon' => 'fa fa-file', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Pdf']], ['label' => '', 'url' => ['print-xsl'], 'icon' => 'fa fa-table', 'linkOptions' => ['class' => 'btn btn-default btn-sm disabled', 'target' => '_blank', 'title' => 'Export to Excel']]]]) . ' '; echo ActionToolbar::widget(['items' => [['label' => 'Create New', 'url' => ['create', 'type' => 100], 'icon' => 'fa fa-plus-square'], ['label' => 'Update', 'url' => ['update'], 'icon' => 'fa fa-pencil', 'linkOptions' => ['class' => 'disabled']], ['label' => 'Delete', 'url' => ['delete'], 'icon' => 'fa fa-trash-o', 'linkOptions' => ['class' => 'disabled', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]], ['label' => 'Goods Movement List', 'url' => ['index'], 'icon' => 'fa fa-list', 'linkOptions' => ['class' => 'disabled']]]]); ?> <div class="box box-info"> <div class="box-body no-padding"> <?php $filterRef = []; foreach (Configs::movement() as $key => $value) { $filterRef[$key] = isset($value['name']) ? $value['name'] : $key; } ?> <?php \yii\widgets\Pjax::begin(['enablePushState' => false]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'number', 'date:date', ['attribute' => 'reff_type', 'value' => 'nmReffType', 'filter' => $filterRef], ['label' => 'Reference', 'value' => 'reffLink', 'format' => 'raw'], ['attribute' => 'warehouse_id', 'value' => 'warehouse.name', 'filter' => Warehouse::selectOptions()], ['attribute' => 'status', 'format' => 'raw', 'filter' => [GoodsMovement::STATUS_DRAFT => 'Draft', GoodsMovement::STATUS_PROCESS => 'Proccess', GoodsMovement::STATUS_CLOSE => 'Closed'], 'value' => function ($data) { $color = $data->status == GoodsMovement::STATUS_DRAFT ? 'danger' : 'success'; $color = $data->status == GoodsMovement::STATUS_PROCESS ? 'info' : $color; $color = $data->status == GoodsMovement::STATUS_CLOSE ? 'success' : $color; return Html::tag('small', $data->nmStatus, ['class' => 'label label-' . $color]); }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{update}{delete}{apply}']]]); ?> <?php \yii\widgets\Pjax::end(); ?> </div> </div> </section> </div>