From: Alexander Smirnov Date: Fri, 31 Jan 2025 11:21:06 +0000 (+0300) Subject: [ERP-283] предпредыдущий месяц X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=020c9dd7f00d8d4bbcc32068b85bb91bb017c053;p=erp24_rep%2Fyii-erp24%2F.git [ERP-283] предпредыдущий месяц --- diff --git a/erp24/controllers/SalesWriteOffsPlanController.php b/erp24/controllers/SalesWriteOffsPlanController.php index fc69a2e8..daa96794 100644 --- a/erp24/controllers/SalesWriteOffsPlanController.php +++ b/erp24/controllers/SalesWriteOffsPlanController.php @@ -31,8 +31,8 @@ class SalesWriteOffsPlanController extends Controller $model->load(Yii::$app->request->get()); - $prevMonthStart = date("Y-m-01", strtotime("-1 month", strtotime($model->year . "-" . $model->month . "-01"))); - $prevMonthEnd = date("Y-m-t", strtotime("-1 month", strtotime($model->year . "-" . $model->month . "-01"))); + $prevPrevMonthStart = date("Y-m-01", strtotime("-2 month", strtotime($model->year . "-" . $model->month . "-01"))); + $prevPrevMonthEnd = date("Y-m-t", strtotime("-2 month", strtotime($model->year . "-" . $model->month . "-01"))); $years = []; for ($i = 3; $i >= 0; $i--) { @@ -46,7 +46,7 @@ class SalesWriteOffsPlanController extends Controller $sales = Sales::find()->select([ "sum(CASE WHEN operation='Продажа' THEN summ ELSE (CASE WHEN operation='Возврат' THEN -summ ELSE 0 END) END) as total", 'store_id']) - ->where(['between', 'date', $prevMonthStart, $prevMonthEnd]) + ->where(['between', 'date', $prevPrevMonthStart, $prevPrevMonthEnd]) ->groupBy(['store_id']) ->indexBy('store_id') ->asArray()->all(); diff --git a/erp24/views/sales-write-offs-plan/index.php b/erp24/views/sales-write-offs-plan/index.php index c15a9ebb..0df15a5d 100644 --- a/erp24/views/sales-write-offs-plan/index.php +++ b/erp24/views/sales-write-offs-plan/index.php @@ -141,7 +141,8 @@ function colorScheme2($p) { МагазиныTotalОффлайн торговляОнлайн торговля Оффлайн + онлайн торговляМагазинИнтернет-магазинМаркетплейсы - ПродажиК прошлому месяцуСписанияК ПлануЦельК прошлому месяцуЦельК прошлому месяцуЦельК прошлому месяцу + ПродажиК позапрошлому месяцуСписанияК ПлануЦельК позапрошлому месяцу + ЦельК позапрошлому месяцуЦельК позапрошлому месяцу