public function __constructSubReport()
    {
        $this->registerEvent(
            "OnInit",
            function () {
                $params = array_merge($this->params, $_POST);
                if (isset($params["@subReport"])) {
                    $name = $params["@subReport"];
                    unset($params["@subReport"]);
                    $settings = $this->settings();
                    $subReports = Utility::get($settings, "subReports");
                    $class = Utility::get($subReports, $name);
                    if ($class!=null) {
                        $params["@reportName"] = $name;
                        $r = new $class($params);
                        echo "<subreport-partial>";
                        $r->run()->render();
                        echo "</subreport-partial>";
                    } else {
                        header("HTTP/1.1 404 Could not find [$name] sub report");
                    }
                    exit;              
                }    
            }
        );
        $this->registerEvent(
            "OnResourceInit",
            function () {
                $this->getResourceManager()->addScriptFileOnBegin(
                    $this->getResourceManager()->publishAssetFolder(
                        realpath(dirname(__FILE__)."/../clients/core")
                    )."/KoolReport.subReport.js"
                );
            }
        );
    }