function allocate_centers($_POST)
{
    extract($_POST);
    if (!isset($adds) or !is_array($adds)) {
        return get_allocation($_POST, "<li class='err'>Please select at least one Cost Center to add.</li>");
    }
    if (!isset($project) or strlen($project) < 1) {
        return "<li class='err'>Invalid Use Of Module. (Invalid Project)</li>";
    }
    if (!isset($subsub) or strlen($subsub) < 1) {
        return "<li class='err'>Invalid Use Of Module. (Invalid Sub Sub Project)</li>";
    }
    db_connect();
    $get_pro2 = "SELECT sub_project_id FROM sub_sub_projects WHERE id = '{$subsub}' LIMIT 1";
    $run_pro2 = db_exec($get_pro2) or errDie("Unable to get sub project information.");
    if (pg_numrows($run_pro2) < 1) {
        $project2 = "";
    } else {
        $parr = pg_fetch_array($run_pro2);
        $project2 = $parr['sub_project_id'];
    }
    foreach ($adds as $each) {
        $ins_sql = "DELETE FROM costcenters_links WHERE ccid = '{$each}' AND project1 = '{$project}' AND project3 = '{$subsub}'";
        $run_ins = db_exec($ins_sql) or errDie("Unable to add cost center information.");
    }
    header("Location: costcenter-allocation-rem.php?project={$project}&subsub={$subsub}");
}
function allocate_centers($_POST)
{
    extract($_POST);
    if (!isset($adds) or !is_array($adds)) {
        return get_allocation($_POST, "<li class='err'>Please select at least one Cost Center to add.</li>");
    }
    if (!isset($project) or strlen($project) < 1) {
        return "<li class='err'>Invalid Use Of Module. (Invalid Project)</li>";
    }
    if (!isset($subsub) or strlen($subsub) < 1) {
        return "<li class='err'>Invalid Use Of Module. (Invalid Sub Sub Project)</li>";
    }
    db_connect();
    $get_pro2 = "SELECT sub_project_id FROM sub_sub_projects WHERE id = '{$subsub}' LIMIT 1";
    $run_pro2 = db_exec($get_pro2) or errDie("Unable to get sub project information.");
    if (pg_numrows($run_pro2) < 1) {
        $project2 = "";
    } else {
        $parr = pg_fetch_array($run_pro2);
        $project2 = $parr['sub_project_id'];
    }
    foreach ($adds as $each) {
        $ins_sql = "INSERT INTO costcenters_links (ccid,project1,project2,project3) VALUES ('{$each}','{$project}','{$project2}','{$subsub}')";
        $run_ins = db_exec($ins_sql) or errDie("Unable to add cost center information.");
    }
    //	$display = "
    //					<table ".TMPL_tblDflts.">
    //
    //					</table>
    //				";
    //	return $display;
    header("Location: costcenter-allocation-rem.php?project={$project}&subsub={$subsub}");
}