From: Alexander Smirnov Date: Tue, 18 Feb 2025 17:01:41 +0000 (+0300) Subject: [ERP-310] total X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=86b8627c2e4c51fc16b1f837caac43b27af98afd;p=erp24_rep%2Fyii-erp24%2F.git [ERP-310] total --- diff --git a/erp24/controllers/MatrixStatisticsController.php b/erp24/controllers/MatrixStatisticsController.php index cbd605d8..dfdd4173 100644 --- a/erp24/controllers/MatrixStatisticsController.php +++ b/erp24/controllers/MatrixStatisticsController.php @@ -35,10 +35,11 @@ class MatrixStatisticsController extends Controller { $model->load(Yii::$app->request->get()); /////////////////////////////////////////// - $sales = Sales::find()->where(['operation' => Sales::OPERATION_SALE]) + $sales = Sales::find()->select(['SUM(summ) as total'])->where(['operation' => Sales::OPERATION_SALE]) ->andWhere(['>=', 'date', date($model->year . '-' . $model->month . '-01 00:00:00')]) - ->andWhere(['<=', 'date', date($model->year . '-' . $model->month . '-t 23:59:59')]) - ->all(); + ->andWhere(['<=', 'date', date($model->year . '-' . $model->month . '-10 23:59:59')]) + ->asArray()->one(); + $total = $sales['total'] ?? 0; /////////////////////////////////////////// $years = []; for ($i = 3; $i >= 0; $i--) { @@ -48,7 +49,7 @@ class MatrixStatisticsController extends Controller { $stores = ArrayHelper::map(CityStore::find()->andWhere(['visible' => '1'])->all(), 'id', 'name'); - return $this->render('index', compact('model', 'years', 'stores')); + return $this->render('index', compact('model', 'years', 'stores', 'total')); } public function actionGetStores() { diff --git a/erp24/views/matrix-statistics/index.php b/erp24/views/matrix-statistics/index.php index 12d558ed..a2ce9195 100644 --- a/erp24/views/matrix-statistics/index.php +++ b/erp24/views/matrix-statistics/index.php @@ -15,7 +15,7 @@ use yii_app\records\StoreType; /* @var $model DynamicModel */ /* @var $years array */ /* @var $stores array */ - +/* @var $total float */ $this->registerJsFile('/js/matrix-statistics/index.js', ['position' => \yii\web\View::POS_END]); @@ -147,7 +147,7 @@ $this->registerJsFile('/js/matrix-statistics/index.js', ['position' => \yii\web\
Сумма тотал
-
976 250 р
+
р
% цели магазина