}
require_once $root_path . 'include/care_api_classes/class_template.php';
$tp_obj = new Template($root_path, $template_path, $template_theme);
require_once $root_path . 'include/care_api_classes/class_drg.php';
$DRG_obj = new DRG($pn);
$toggle = 0;
$thisfile = basename($_SERVER['PHP_SELF']);
if (isset($mode)) {
    /* Prepare the common data */
    $_POST['history'] = "Create " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n";
    //$_POST['modify_id']=$_SESSION['sess_user_name'];
    $_POST['create_id'] = $_SESSION['sess_user_name'];
    $_POST['create_time'] = date('YmdHis');
    switch ($mode) {
        case 'save':
            $DRG_obj->useInternalDRGCodes();
            // Set the core variables
            $DRG_obj->setDataArray($_POST);
            // transfer the data
            if ($DRG_obj->insertDataFromInternalArray()) {
                $oid = $db->Insert_ID();
                // Get the insert ID
                $group_nr = $DRG_obj->LastInsertPK('nr', $oid);
                $saveok = true;
                //header("location:$thisfile?sid=$sid&lang=$lang&saveok=1&pn=$pn&opnr=$opnr&group_nr=$group_nr&ln=$ln&fn=$fn&bd=$bd&dept_nr=$dept_nr&oprm=$oprm&y=$y&m=$m&d=$d&display=$display&target=$target");
                //exit;
            } else {
                $saveok = false;
            }
            break;
        case 'linkgroup':