示例#1
0
        $arParentFilter = array('IBLOCK_ID' => $IBlockID, 'GLOBAL_ACTIVE' => 'Y', '!LEFT_MARGIN' => $report['LEFT_MARGIN'], '!RIGHT_MARGIN' => $report['RIGHT_MARGIN'], '!ID' => $report["DEPARTMENT_ID"]);
        $rsParentSections = CIBlockSection::GetList(array('left_margin' => asc), $arParentFilter);
        $arResult["DEPARTMENTS"][$report["DEPARTMENT_ID"]]["PARENTS"] = array();
        while ($section = $rsParentSections->GetNext()) {
            $arResult["DEPARTMENTS"][$report["DEPARTMENT_ID"]]["PARENTS"][] = $section;
        }
    }
}
$arDepartmentsFilter = $arFilter;
if (!isset($arDepartmentsFilter["DEPARTMENT_ID"])) {
    $arDepartmentsFilter["DEPARTMENT_ID"] = array_keys($arResult["DEPARTMENTS"]);
}
if (isset($arDepartmentsFilter["RESPONSIBLE_ID"])) {
    unset($arDepartmentsFilter["RESPONSIBLE_ID"]);
}
$rsDepartmentsReports = CTaskReport::GetDepartementStats($arDepartmentsFilter);
while ($departmentStats = $rsDepartmentsReports->GetNext()) {
    $arResult["DEPARTMENTS"][$departmentStats["DEPARTMENT_ID"]]["STATS"] = $departmentStats;
}
// whole company
$arCompanyFilter = $arFilter;
if (isset($arCompanyFilter["RESPONSIBLE_ID"])) {
    unset($arCompanyFilter["RESPONSIBLE_ID"]);
}
if (isset($arCompanyFilter["DEPARTMENT_ID"])) {
    unset($arCompanyFilter["DEPARTMENT_ID"]);
}
if (isset($arCompanyFilter["GROUP_ID"])) {
    unset($arCompanyFilter["GROUP_ID"]);
}
$rsCompanyStats = CTaskReport::GetCompanyStats($arCompanyFilter);