关键指标

$total_customers, 'new_customers' => $new_customers, 'avg_customer_value' => $avg_customer_value, 'retention_rate' => $retention_data['retention_rate'], 'retained_count' => $retention_data['retained_count'], 'total_previous' => $retention_data['total_previous'], 'conversion_rate' => $conversion_data['conversion_rate'], 'customers_with_orders' => $conversion_data['customers_with_orders'] ]; // 渲染关键指标卡片 renderKeyMetricsCard($kpi_data); ?>

新增客户明细

业务员新增客户统计

prepare($sql); $stmt->bind_param("ss", $start_date, $end_date); $stmt->execute(); $result = $stmt->get_result(); $customers = []; while ($row = $result->fetch_assoc()) { $customers[] = $row; } return $customers; } /** * 获取各业务员新增客户统计 * * @param mysqli $conn 数据库连接 * @param string $start_date 开始日期 * @param string $end_date 结束日期 * @return array 业务员新增客户统计数据 */ function getNewCustomersByEmployee($conn, $start_date, $end_date) { $sql = "SELECT e.id as employee_id, e.em_user as employee_name, COUNT(c.id) as customer_count FROM employee e LEFT JOIN customer c ON e.id = c.cs_belong AND c.cs_addtime BETWEEN ? AND ? WHERE e.em_role IS NOT NULL GROUP BY e.id ORDER BY customer_count DESC"; $stmt = $conn->prepare($sql); $stmt->bind_param("ss", $start_date, $end_date); $stmt->execute(); $result = $stmt->get_result(); $data = []; while ($row = $result->fetch_assoc()) { $data[] = $row; } return $data; } /** * 渲染新增客户图表 * * @param array $customers 新增客户数据 * @return void */ function renderNewCustomersChart($customers) { if (empty($customers)) { echo '
该时间段内没有新增客户数据
'; return; } ?>
客户名称 客户编码 国家/地区 客户类型 负责业务员 添加日期
该时间段内没有业务员新增客户数据'; return; } // 准备图表数据 $employee_names = []; $customer_counts = []; foreach ($employee_data as $row) { $employee_names[] = $row['employee_name']; $customer_counts[] = $row['customer_count']; } // 生成图表背景色 $colors = generateChartColors(count($employee_data)); $backgroundColors = []; $borderColors = []; foreach ($colors as $color) { $backgroundColors[] = $color[0]; $borderColors[] = $color[1]; } ?>
业务员 新增客户数量