From: Vladimir Fomichev Date: Thu, 5 Sep 2024 08:45:05 +0000 (+0300) Subject: Правки по ревью X-Git-Tag: 1.4^2~4 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=010af185a67f46487d5e4e1ea4c8a2da75951ab3;p=erp24_rep%2Fyii-erp24%2F.git Правки по ревью --- diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index 947d8c35..e09985f7 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -1772,22 +1772,23 @@ class MotivationService $storeId = (int)$storeId; + $startDate = date('Y-m-d', strtotime($startDate)); + $endDate = date('Y-m-d 23:59:59', strtotime($endDate)); + $salesRecords = Sales::find() ->select(['id', 'date']) - ->where(['store_id' => $storeId, 'operation' => 'Продажа']) + ->where(['store_id' => $storeId, 'operation' => Sales::OPERATION_SALE]) ->andWhere(['>=', 'date', $startDate]) ->andWhere(['<=', 'date', $endDate]) ->asArray() ->all(); - $startDate = date('Y-m-d', strtotime($startDate)); - $endDate = date('Y-m-d', strtotime($endDate)); - $endDatePlusThreeWeeks = date('Y-m-d', strtotime($endDate . ' +3 weeks')); + $endDatePlusThreeWeeks = date('Y-m-d 23:59:59', strtotime($endDate . ' +3 weeks')); $returnedSales = Sales::find() ->select(['sales_check']) - ->where(['store_id' => $storeId, 'operation' => 'Возврат']) + ->where(['store_id' => $storeId, 'operation' => Sales::OPERATION_RETURN]) ->andWhere(['>=', 'date', $startDate]) ->andWhere(['<=', 'date', $endDatePlusThreeWeeks]) // $endDate + 3 недели ->andWhere(['is not', 'sales_check', null]) // Проверяем, что поле sales_check не пустое @@ -1838,11 +1839,25 @@ class MotivationService $quantity = (float)$product['quantity']; $checkDate = date('Y-m-d', strtotime($saleDates[$product['check_id']])); - if (isset($selfCostsMap[$productId][$checkDate])) { - $totalSum += $selfCostsMap[$productId][$checkDate] * $quantity; + // Логирование отсутствующих данных о себестоимости + if (!isset($selfCostsMap[$productId][$checkDate])) { + + Yii::info("Не найдена себестоимость для продукта $productId на дату $checkDate", __METHOD__); + + + InfoLogService::setInfoLog(__FILE__, __LINE__, 'SelfCostProduct', "error_id_100: Продукт $productId на дату $checkDate не имеет себестоимости"); + + + $price = 0.0; + } else { + $price = $selfCostsMap[$productId][$checkDate]; } + + + $totalSum += $price * $quantity; } + return $totalSum; } diff --git a/erp24/views/store/polnogramma.php b/erp24/views/store/polnogramma.php new file mode 100644 index 00000000..b3d9bbc7 --- /dev/null +++ b/erp24/views/store/polnogramma.php @@ -0,0 +1 @@ +