我如何在 sugarcrm(ce) 中添加汇总功能

how can i add rollup functionality in sugarcrm(ce)

谁能告诉我如何在 sugarCRM(Ce) 中添加汇总功能。

我们的要求是"sum of project amounts to roll up to opportunity amount field in sugar crm"

您可以添加一个具有动态计算总和的函数的字段。 或者使用逻辑挂钩,在添加子模块项时添加到真实的数据库字段。

您可以通过如下所述编写after_save logic hook来实现它:

我在 sum of pending amount of each cases will be store in accounts module.

中实现了类似的功能
$customer_id = $_REQUEST['mc_companyusers_cases_1mc_companyusers_ida'];

if($customer_id){

    $rs = $bean->db->query("SELECT cc.pending_payment_c FROM mc_companyusers_cases_1_c m inner join  cases c on  m.`mc_companyusers_cases_1cases_idb` = c.`id` inner join cases_cstm cc on cc.`id_c` = c.`id` where m.`mc_companyusers_cases_1mc_companyusers_ida` = '".$customer_id."'");
    $total_pending_amount = 0;
    while($row = $bean->db->fetchByAssoc($rs)){
        $total_pending_amount += $row['pending_payment_c'];
    }

    $bean->db->query("Update mc_companyusers_cstm set total_pending_payment_c='".$total_pending_amount."' where id_c='".$customer_id."'");

}

因此,您可以在上述查询中将项目模块与案例和机会模块与客户进行映射。

谢谢。