From b214709f041dadcd81d17b02e0c1b93459c54bc9 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Fri, 30 Aug 2024 12:48:38 +0300 Subject: [PATCH] =?utf8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?utf8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20=D0=BD=D0=B0?= =?utf8?q?=20=D0=BF=D1=83=D1=81=D1=82=D0=BE=D0=B9=20=D0=BC=D0=B0=D1=81?= =?utf8?q?=D1=81=D1=81=D0=B8=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/actions/motivation/IndexAction.php | 4 +++- erp24/services/MotivationService.php | 13 ++----------- erp24/views/motivation/index.php | 3 ++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/erp24/actions/motivation/IndexAction.php b/erp24/actions/motivation/IndexAction.php index 1aaeb10c..d552d7c4 100644 --- a/erp24/actions/motivation/IndexAction.php +++ b/erp24/actions/motivation/IndexAction.php @@ -169,8 +169,10 @@ class IndexAction extends Action $row['forecast'] = $row['plan']; } } + if(!empty($motivationDataTableSort)){ + $motivationDataTableSort = MotivationService::calculateFactFormula($motivationDataTableSort, $model->year, $model->month); + } - $motivationDataTableSort = MotivationService::calculateFactFormula($motivationDataTableSort, $model->year, $model->month); // Формируем заголовок для 5-й недели if ($model->month == 2) { // Февраль diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index a720cf8f..23473923 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1125,23 +1125,14 @@ class MotivationService default: { $column = 'week' . $indexItem; break; } } - // Проверка на наличие необходимого ключа в $indMap - if (isset($indMap[self::CODE_SALE_OF_GOODS]) && - isset($indMap[self::CODE_OFFLINE_SALES]) && - isset($indMap[self::CODE_ONLINE_SALES])) { + // Выполняем вычисление только если все нужные ключи существуют $motivationDataTableSort[$indMap[self::CODE_SALE_OF_GOODS]][$column] = $motivationDataTableSort[$indMap[self::CODE_OFFLINE_SALES]][$column] + $motivationDataTableSort[$indMap[self::CODE_ONLINE_SALES]][$column] + 0; - } else { - Yii::error("Один из ключей отсутствует: " . - (isset($indMap[self::CODE_SALE_OF_GOODS]) ? '' : 'CODE_SALE_OF_GOODS ') . - (isset($indMap[self::CODE_OFFLINE_SALES]) ? '' : 'CODE_OFFLINE_SALES ') . - (isset($indMap[self::CODE_ONLINE_SALES]) ? '' : 'CODE_ONLINE_SALES ') - ); - } + $motivationDataTableSort[$indMap[self::CODE_OTHER_SERVICES]][$column] = // "Прочие услуги" $motivationDataTableSort[$indMap[self::CODE_ASSEMBLY_SERVICES]][$column] + // "Услуги по сборке" diff --git a/erp24/views/motivation/index.php b/erp24/views/motivation/index.php index dd04fd36..24542d14 100644 --- a/erp24/views/motivation/index.php +++ b/erp24/views/motivation/index.php @@ -353,5 +353,6 @@ $this->registerJsFile('/js/motivation/index.js', ['position' => \yii\web\View::P - + + store_id); ?> \ No newline at end of file -- 2.39.5