Example #1
0
    foreach ($leads_funnel as $lf) {
        if ($lf["progress"] < 100 || $lf["progress"] == 200) {
            $total_leads = $total_leads + $lf["total_leads"];
        }
    }
    foreach ($leads_funnel as $lf) {
        $completion = $lf["total_leads"] / $total_leads * 100;
        if ($total_leads <= 0) {
            $completion = 0;
        } else {
            $completion = $lf["total_leads"] / $total_leads * 100;
        }
        $data[$lf["progress"]]["completion"] = $completion;
        $data[$lf["progress"]]["amount"] = $lf["amount"];
    }
    $leads_funnel_content = funnel($data, $config["font"], $ttl, $config["homedir"]);
} else {
    $leads_funnel_content = __('No data to show');
}
$leads_country_content = '<br><div class="pie_frame">' . $leads_funnel_content . '</div>';
echo print_container('funnel', __('Leads Funnel'), $leads_country_content, 'no', true, true, "container_simple_title", "container_simple_div");
//CONVERSION RATE
$success_leads_array = crm_get_all_leads($where_clause . " AND progress = 200 ");
$total_leads_array = crm_get_all_leads($where_clause);
if ($read && $enterprise) {
    $success_leads_array = crm_get_user_leads($config['id_user'], $success_leads_array);
    $total_leads_array = crm_get_user_leads($config['id_user'], $total_leads_array);
}
$total_success = 0;
if ($success_leads_array) {
    $total_success = count($success_leads_array);
Example #2
0
        if ($lf["progress"] < 100 || $lf["progress"] == 200) {
            $total_leads = $total_leads + $lf["total_leads"];
        }
    }
    foreach ($leads_funnel as $lf) {
        $completion = $lf["total_leads"] / $total_leads * 100;
        if ($total_leads <= 0) {
            $completion = 0;
        } else {
            $completion = $lf["total_leads"] / $total_leads * 100;
        }
        $data[$lf["progress"]]["completion"] = $completion;
        $data[$lf["progress"]]["amount"] = $lf["amount"];
        $data[$lf["progress"]]["total_leads"] = $lf["total_leads"];
    }
    $leads_funnel_content = funnel($data, $config["font"], $ttl);
} else {
    $leads_funnel_content = "<div style='padding-top: 151px; padding-bottom: 151px'>";
    $leads_funnel_content .= __('No data to show');
    $leads_funnel_content .= "</div>";
}
//Print lead's funnel
$leads_country_content = '<br><div class="pie_frame">' . $leads_funnel_content . '</div>';
echo print_container('funnel', __('Leads Funnel'), $leads_country_content, 'no', true, true, "container_simple_title", "container_simple_div");
//ROI
$total_revenue = 0;
if (isset($data[200]["amount"])) {
    $total_revenue = $data[200]["amount"];
}
$expenses = $campaign["expenses"];
$roi = ($total_revenue - $expenses) / $expenses * 100;