foreach ($fields as $field) {
                $EstimateComponents->{$field} = $components_array[$i]->{$field};
            }
            $EstimateComponents->id = null;
            $EstimateComponents->date_entered = null;
            $EstimateComponents->date_modified = null;
            $EstimateComponents->created_by = null;
            $EstimateComponents->modified_user_id = null;
            $EstimateComponents->assigned_user_id = null;
            $EstimateComponents->assigned_user_name = null;
            $EstimateComponents->parent_bean = 'Estimates';
            $EstimateComponents->parent_id = $focus->id;
            $EstimateComponents->parent_name = $focus->name;
            $EstimateComponents->number = $EstimateComponents->generate_number('number', 'estimates_components', $focus->id, $focus->table_name);
            //$EstimateComponents->number = $focus->generate_number('number','estimates_components', $focus->id, $focus->table_name);
            $EstimateComponents->save($GLOBALS['check_notify']);
        }
    }
}
$xtpl->assign('MOD', $mod_strings);
$xtpl->assign('APP', $app_strings);
$xtpl->assign('name', $focus->name);
/// handle product
$style_display = "display:none";
if (isset($_REQUEST['product_id']) && !empty($_REQUEST['product_id'])) {
    $focus->product_id = $_REQUEST['product_id'];
}
if (!is_null($focus->product_id) && !empty($focus->product_id)) {
    $product = new Products();
    $product->retrieve($focus->product_id);
    $xtpl->assign("number", $product->pnum);