From: JoySystem_v Date: Tue, 27 Aug 2024 13:43:09 +0000 (+0300) Subject: добавлен контроллер и представление с фильтрами X-Git-Tag: 1.4~24^2~3 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=4f72237c605c96f435243bc83aa680544d4d8c18;p=erp24_rep%2Fyii-erp24%2F.git добавлен контроллер и представление с фильтрами --- diff --git a/erp24/controllers/SelfCostProductController.php b/erp24/controllers/SelfCostProductController.php new file mode 100644 index 00000000..356acae4 --- /dev/null +++ b/erp24/controllers/SelfCostProductController.php @@ -0,0 +1,38 @@ +search(Yii::$app->request->queryParams); + + $stores = ArrayHelper::map(CityStore::find()->all(), 'id', 'name'); + + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'stores' => $stores + ]); + } + + protected function findModel($id) + { + if (($model = SelfCostProduct::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/erp24/records/SelfCostProductSearch.php b/erp24/records/SelfCostProductSearch.php new file mode 100644 index 00000000..63d00b19 --- /dev/null +++ b/erp24/records/SelfCostProductSearch.php @@ -0,0 +1,56 @@ + $query, + 'pagination' => [ + 'pageSize' => 20, + ], + 'sort' => [ + 'defaultOrder' => [ + 'date' => SORT_DESC, + ] + ], + ]); + + $this->load($params); + + if (!$this->validate()) { + // если валидация не удалась, не возвращаем записи + $query->where('0=1'); + return $dataProvider; + } + + // Фильтрация по параметрам + $query->andFilterWhere([ + 'id' => $this->id, + 'store_id' => $this->store_id, + 'price' => $this->price, + 'date' => $this->date, + ]); + + $query->andFilterWhere(['like', 'product_guid', $this->product_guid]); + + return $dataProvider; + } +} \ No newline at end of file diff --git a/erp24/views/crud/employee-payment/_search.php b/erp24/views/crud/employee-payment/_search.php index ac3f00cd..33da5db6 100755 --- a/erp24/views/crud/employee-payment/_search.php +++ b/erp24/views/crud/employee-payment/_search.php @@ -65,7 +65,7 @@ use yii\widgets\ActiveForm;
'btn btn-primary']) ?> - 'btn btn-outline-secondary']) ?> + 'btn btn-outline-secondary']) ?>
diff --git a/erp24/views/self-cost-product/index.php b/erp24/views/self-cost-product/index.php new file mode 100644 index 00000000..bca9b393 --- /dev/null +++ b/erp24/views/self-cost-product/index.php @@ -0,0 +1,73 @@ +title = 'Себестоимость товаров'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + + + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'date:text:Дата', + 'store_id:text:Магазин', + 'product_guid:text:GUID товара', + 'price:text:Цена', + 'updated_at:text:Обновлено', + + + ], + ]); ?> + +