コード例 #1
0
ファイル: StockOpname.php プロジェクト: sangkil/biz3-distro
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StockOpnameModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'warehouse_id' => $this->warehouse_id, 'date' => $this->date, 'status' => $this->status, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'number', $this->number])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'operator', $this->operator]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the StockOpname model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return StockOpname the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StockOpname::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOpname()
 {
     return $this->hasOne(StockOpname::className(), ['id' => 'opname_id']);
 }
コード例 #4
0
ファイル: index.php プロジェクト: sangkil/biz3-distro
/* @var $searchModel backend\models\inventory\search\StockOpname */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Stock Opnames';
$this->params['breadcrumbs'][] = $this->title;
?>
<p class='pull-right'>
    <?php 
echo Html::a('Create Stock Opname', ['create'], ['class' => 'btn btn-default']);
?>
    <?php 
$url = array_filter(Yii::$app->getRequest()->get());
$url[0] = 'csv-template';
unset($url['page']);
echo Html::a('<i class="fa fa-download"></i>', $url, ['class' => 'btn btn-default', 'title' => 'Download Template', 'target' => '_blank']);
?>
</p>
<br>

<div class="stock-opname-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'], 'number', 'Date', 'warehouse.name', 'description', 'operator', ['attribute' => 'status', 'value' => 'nmStatus', 'filter' => StockOpname::enums('STATUS_')], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>