如何在sugarcrm(ce)

时间:2016-08-23 07:11:24

标签: sugarcrm

任何人都可以告诉如何在sugarCRM(Ce)中添加汇总功能。

我们的要求是"项目金额的总和,以汇总到糖业的机会金额字段"

2 个答案:

答案 0 :(得分:0)

您可以添加一个具有动态计算总和的函数的字段。 或者使用逻辑钩子,只要添加子模块项,它就会添加到实际的db字段中。

答案 1 :(得分:0)

您可以通过编写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."'");

}

因此,您可以在上述查询中将项目模块与案例和机会模块一起映射到帐户。

谢谢。