[$monthSpeciesGoal['species']] = $monthSpeciesGoal['goal'] ;
}
- $weeksShareResult = $service->getHistoricalWeeklySpeciesShare($filters['plan_date'], $filters, null, 'writeOffs');
+ $weeksShareResult = $service->getHistoricalWeeklySpeciesShare($model->month, $filters, null, 'writeOffs');
$weeksData = $service->calculateWeeklySpeciesGoals($weeksShareResult['weeksData'], $monthSpeciesGoals) ;
$datePlan = $filters['plan_date'];
}
- $weeksShareResult = $service->getHistoricalWeeklySpeciesShare($filters['plan_date'], $filters, null, 'writeOffs');
+ $weeksShareResult = $service->getHistoricalWeeklySpeciesShare($model->month, $filters, null, 'writeOffs');
$weeksData = $service->calculateWeeklySpeciesGoals($weeksShareResult, $monthSpeciesGoals) ;
$datePlan = $filters['plan_date'];
public const TYPE_WRITE_OFFS = 'writeOffs'; // Тип операции: списания
private const CATEGORY_LOOKBACK_MONTHS = 3; // Период для анализа категорий (месяцы)
private const LOOKBACK_MONTHS = 2; // Отступаемый шаг от плановой даты перед расчетами
- private const HELIUM_GUID = '2b72702a-792f-11e8-9edd-1c6f659fb563';
+ public const HELIUM_GUID = '2b72702a-792f-11e8-9edd-1c6f659fb563';
/**
* Получение списка видимых магазинов
?array $productFilter = null,
string $type = 'sales'
): array {
- [$yearStr, $monthStr, $day] = explode('-', $monthYear);
+ [$monthStr, $yearStr] = explode('-', $monthYear);
$month = (int)$monthStr;
$year = (int)$yearStr;
$yearData = [];
$priceDynamics = PricesDynamic::find()
->andWhere(['region_id' => $region])
->andWhere(['product_id' => array_values(ArrayHelper::getColumn($nomenclatures, 'id'))])
+ ->andWhere(['<=', 'date_from', $monthEnd])
+ ->andWhere(['>=', 'date_to', $monthStart])
->orderBy(['date_from' => SORT_DESC])
->all();
if (isset($heliumGuid) && $productId === $heliumGuid) {
if ($multiRegion) {
if (!isset($pricesMap[$productId][$regionId])) {
- $pricesMap[$productId][$regionId] = [$price];
+ $pricesMap[$productId][$regionId] = $price;
} else {
$pricesMap[$productId][$regionId] = min(
$pricesMap[$productId][$regionId],
}
} else {
if (!isset($pricesMap[$productId])) {
- $pricesMap[$productId] = [$price];
+ $pricesMap[$productId] = $price;
} else {
$pricesMap[$productId] = min(
$pricesMap[$productId],