$estimatecalc_id = $focus->get_calc_record($focus->id);
    if (!is_null($estimatecalc_id) && !empty($estimatecalc_id)) {
        $estimateCalc->retrieve($estimatecalc_id);
    }
    $components_estimate = $estimateCalc->componentsEstimate($focus->id);
    $estimateCalc->name = $mod_strings['LBL_EST_NAME_PREFIX'] . "-" . $focus->name;
    $estimateCalc->estimate_name = $focus->name;
    $estimateCalc->estimate_id = $focus->id;
    $estimateCalc->total_paper = $components_estimate['total_paper'];
    $estimateCalc->total_prepress = $components_estimate['total_prepress'];
    $estimateCalc->total_press = $components_estimate['total_press'];
    $estimateCalc->total_operations = $components_estimate['total_operations'];
    $estimateCalc->total_estimate = $components_estimate['total'];
    $estimateCalc->assigned_user_id = $current_user->id;
    $estimateCalc->status = 'uptodate';
    $estimateCalc->save($GLOBALS['check_notify']);
    $focus->sub_status = 'estimated';
    $focus->save($GLOBALS['check_notify']);
    header("Location: index.php?action=DetailView&module=EstimateCalc&record={$estimateCalc->id}");
}
///
///
/// Assign the template variables
///
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
if (isset($_REQUEST['return_module'])) {
    $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
}
if (isset($_REQUEST['return_action'])) {
    $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);