title="' . __('Locked by ' . $locked_id_user) . '">'; } } array_push($table->data, $data); } print_table($table); echo '<form method="post" action="index.php?sec=customers&sec2=operation/companies/company_detail&id=' . $id . '&op=invoices">'; echo '<div class="button" style="width: ' . $table->width . '">'; print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"'); print_input_hidden('new_invoice', 1); echo '</div>'; echo '</form>'; } } } elseif ($op == "leads") { $leads = crm_get_all_leads("WHERE id_company = {$id} and progress < 100"); $leads = print_array_pagination($leads, "index.php?sec=customers&sec2=operation/companies/company_detail&id={$id}&op=leads"); $company_name = get_db_sql("SELECT name FROM tcompany WHERE id = {$id}"); if ($leads !== false) { $table->width = "99%"; $table->class = "listing"; $table->cellspacing = 0; $table->cellpadding = 0; $table->tablealign = "left"; $table->data = array(); $table->size = array(); $table->style = array(); $table->style[0] = 'font-weight: bold'; $table->colspan = array(); $table->head[0] = __('Fullname'); $table->head[1] = __('Owner');
$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); } $total_leads = count($total_leads_array); $conversion_rate = $total_success / $total_leads * 100; $total_amount_success = 0; if (isset($data[200]["amount"])) { $total_amount_success = $data[200]["amount"]; } if (!$clean_output) {
$data[5] = "<span style='font-size: 10px'>".$invoice["invoice_create_date"] . "</span>"; array_push ($table->data, $data); } print_table ($table); } } // Leads if ( check_crm_acl('lead', 'cr') && $show_customers != MENU_HIDDEN ){ $where_clause = " WHERE fullname LIKE '%".$search_string."%' OR email LIKE '%".$search_string."%' OR company LIKE '%".$search_string."%'"; $leads = crm_get_all_leads ($where_clause); if ($leads) { echo "<h3>"; echo __("Leads"); echo "</h3>"; $table = new StdClass(); $table->width = '100%'; $table->class = 'listing'; $table->data = array (); $table->size = array (); $table->style = array (); $table->head = array(); $table->head[0] = __('Name');
$where_clause = get_parameter('where_clause'); $date = get_parameter('date'); $filename = clean_output('company_export') . '-' . date("YmdHi"); $rows = crm_get_companies_list(clean_output($where_clause), $date); if ($rows === false) { return; } } if ($export_csv_leads) { $read = check_crm_acl('company', 'cr'); if (!$read) { exit; } $where_clause = get_parameter('where_clause'); $filename = clean_output('lead_export') . '-' . date("YmdHi"); $rows = crm_get_all_leads(clean_output($where_clause)); if ($rows === false) { return; } } if ($export_csv_inventory) { $filter = unserialize_in_temp($config["id_user"]); $where_clause = $filter["query"]; $rows = get_db_all_rows_sql(clean_output($where_clause)); if ($rows === false) { return; } $filename = clean_output('inventory_export') . '-' . date("YmdHi"); $aux_rows = array(); //Add additional information to raw csv foreach ($rows as $r) {
if ($progress_value >= 100 && $progress_value < 200) $progress_closed[] = $progress_value; } if (empty($progress_closed)) continue; $where = "WHERE 1=1 $where_clause AND progress IN (".implode(",", $progress_closed).") AND UNIX_TIMESTAMP(modification) > " . (time() - SECONDS_3MONTHS); } } else { continue; } } else { $where = "WHERE 1=1 $where_clause AND progress = $k"; } $leads = crm_get_all_leads ($where, "ORDER BY $order_item DESC"); if(!$leads) { $leads = array(); $num_leads = 0; } else { $num_leads = count($leads); } $amount = 0; foreach ($leads as $lead) { $amount += $lead["estimated_sale"]; } if (!$amount) { $amount = 0;