);
}
-
-
$monthSpeciesGoals = $service->calculateFullGoalChainWeighted($filters);
$monthSpeciesGoalsMap = [];
foreach ($monthSpeciesGoals as $monthSpeciesGoal) {
[$monthSpeciesGoal['species']] = $monthSpeciesGoal['goal'] ;
}
-
-
-
$weeksShareResult = $service->getHistoricalWeeklySpeciesShare($model->month, $filters, null, 'writeOffs');
$weeksData = $service->calculateWeeklySpeciesGoals($weeksShareResult['weeksData'], $monthSpeciesGoals) ;
$datePlan = $filters['plan_date'];
$monthCategoryShare = $service->getMonthCategoryShareOrWriteOffWeighted($datePlan, $filters, null, $filters['type']);
- $monthCategoryGoal = $service->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters);
+ $monthCategoryGoal = $service->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
foreach ($monthCategoryShare as $sid => $cats) {
foreach($cats as $cat) {
$monthCategoryShareResult[$sid][$cat['category']]['total_sum_cat'] = $cat['total_sum_cat'];
$dateFromForCategory = (new \DateTime($datePlan))->modify('-' . (self::CATEGORY_LOOKBACK_MONTHS + self::LOOKBACK_MONTHS) . ' months')->format('Y-m-d');
$monthCategoryShare = $this->getMonthCategoryShareOrWriteOff($dateFromForCategory, $filters);
- $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters);
+ $monthCategoryGoal = $this->getMonthCategoryGoal($monthCategoryShare, $datePlan, $filters['type']);
$monthSubcategoryShare = $this->getMonthSubcategoryShareOrWriteOff($datePlan, $filters);
$monthSubcategoryGoal = $this->getMonthSubcategoryGoal($monthSubcategoryShare, $monthCategoryGoal);
?array $productFilter = null,
string $type = 'sales'
): array {
- [$yearStr, $monthStr, $_ ] = explode('-', $monthYear);
+ [$monthStr, $yearStr] = explode('-', $monthYear);
$month = (int)$monthStr;
$year = (int)$yearStr;
$yearData = [];