public function getWithOutChildren()
 {
     $query = ProductGroup::find();
     if ($this->id) {
         $query->andWhere(['NOT IN', 'id', $this->getChildrenIds()]);
     }
     return $query->all();
 }
Exemple #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProductGroup::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(['id' => $this->id, 'created_time' => $this->created_time, 'last_update' => $this->last_update, 'product_category_id' => $this->product_category_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'detail', $this->detail]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProductGroup::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(['product_group_id' => $this->product_group_id, 'total_product' => $this->total_product, 'total_price' => $this->total_price, 'total_discount' => $this->total_discount, 'flag_active' => $this->flag_active, 'date_added' => $this->date_added, 'date_update' => $this->date_update]);
     $query->andFilterWhere(['like', 'product_group_desc', $this->product_group_desc]);
     return $dataProvider;
 }
Exemple #4
0
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?php app\components\Util::createButton(); ?>
    
    <?=
    GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'code',
            'name',
            [
                'attribute' => 'product_group_id',
                'value' => function($data) {
                    return $data->getProductGroup()->one()->name;
                },
                'filter' => Html::activeDropDownList($searchModel, 'product_group_id', ArrayHelper::map(ProductGroup::find()->asArray()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => Yii::t('app', 'All')]),
            ],            
            'detail:ntext',
            // 'created_time',
            // 'last_update',
            // 'user_id',
            // 'product_unit_id',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]);
    ?>

</div>
Exemple #5
0
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\ProductGroupDetail */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-group-detail-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'product_group_id')->dropDownList(ArrayHelper::map(ProductGroup::find()->all(), 'product_group_id', 'product_group_desc'), ['prompt' => 'Select Product Group Description']);
?>

    <?php 
echo $form->field($model, 'product_id')->dropDownList(ArrayHelper::map(Products::find()->all(), 'product_id', 'product_name'), ['prompt' => 'Select Product Name']);
?>

    <?php 
echo $form->field($model, 'product_qty')->textInput();
?>

    <?php 
echo $form->field($model, 'product_ori_price')->textInput(['maxlength' => true]);
?>

    <?php