$clientordercalc_id = $focus->get_calc_record($focus->id);
    if (!is_null($clientordercalc_id) && !empty($clientordercalc_id)) {
        $clientorderCalc->retrieve($clientordercalc_id);
    }
    $components_clientorder = $clientorderCalc->componentsClientorder($focus->id);
    $clientorderCalc->name = $mod_strings['LBL_EST_NAME_PREFIX'] . "-" . $focus->name;
    $clientorderCalc->clientorder_name = $focus->name;
    $clientorderCalc->clientorder_id = $focus->id;
    $clientorderCalc->total_paper = $components_clientorder['total_paper'];
    $clientorderCalc->total_prepress = $components_clientorder['total_prepress'];
    $clientorderCalc->total_press = $components_clientorder['total_press'];
    $clientorderCalc->total_operations = $components_clientorder['total_operations'];
    $clientorderCalc->total_clientorder = $components_clientorder['total'];
    $clientorderCalc->assigned_user_id = $current_user->id;
    $clientorderCalc->status = 'uptodate';
    $clientorderCalc->save($GLOBALS['check_notify']);
    $focus->status = 'clientorderd';
    $focus->save($GLOBALS['check_notify']);
    header("Location: index.php?action=DetailView&module=ClientorderCalc&record={$clientorderCalc->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']);