From 4f72237c605c96f435243bc83aa680544d4d8c18 Mon Sep 17 00:00:00 2001 From: JoySystem_v Date: Tue, 27 Aug 2024 16:43:09 +0300 Subject: [PATCH] =?utf8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80?= =?utf8?q?=20=D0=B8=20=D0=BF=D1=80=D0=B5=D0=B4=D1=81=D1=82=D0=B0=D0=B2?= =?utf8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=20=D1=84=D0=B8=D0=BB?= =?utf8?q?=D1=8C=D1=82=D1=80=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/SelfCostProductController.php | 38 ++++++++++ erp24/records/SelfCostProductSearch.php | 56 ++++++++++++++ erp24/views/crud/employee-payment/_search.php | 2 +- erp24/views/self-cost-product/index.php | 73 +++++++++++++++++++ 4 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 erp24/controllers/SelfCostProductController.php create mode 100644 erp24/records/SelfCostProductSearch.php create mode 100644 erp24/views/self-cost-product/index.php 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:Обновлено', + + + ], + ]); ?> + +
-- 2.39.5