= htmlspecialcharsFix($row['em_user']) ?> |
= htmlspecialcharsFix($row['em_user']) ?> |
= $c1 ?> |
= $clstr ?> |
= $c2 ?> |
= $c4 ?> |
query("SELECT id, em_user FROM employee WHERE em_role=" . $row['id']);
while ($memberRow = $memberResult->fetch_assoc()) {
$clstr = "";
// Get member's total customer count
$mc1Result = $conn->query("SELECT COUNT(DISTINCT c.cs_code) as c1 FROM customer c WHERE c.cs_belong=" . $memberRow['id']);
$mc1Row = $mc1Result->fetch_assoc();
$mc1 = $mc1Row['c1'];
// Get member's customers going to public sea
$mc2Result = $conn->query("SELECT COUNT(DISTINCT c.cs_code) as c2 FROM customer c
WHERE c.cs_deal<>3 AND c.cs_deal<>0 AND c.cs_type<>2
AND DATEDIFF(NOW(), c.cs_updatetime) > 90
AND c.cs_belongclient=0 AND c.cs_belong=" . $memberRow['id']);
$mc2Row = $mc2Result->fetch_assoc();
$mc2 = $mc2Row['c2'];
// Get member's deals in date range
$mc3Result = $conn->query("SELECT DISTINCT c.cs_code FROM customer c
WHERE c.cs_dealdate > '" . $conn->real_escape_string($datestart) . "'
AND c.cs_dealdate <= '" . $conn->real_escape_string($dateend) . "'
AND c.cs_deal=3 AND c.cs_belong=" . $memberRow['id']);
$mc3 = $mc3Result->num_rows;
while ($mc3Row = $mc3Result->fetch_assoc()) {
$clstr .= $mc3Row['cs_code'] . "