Public feed
#725267
// calculate the costs
switch($brandserviceid) {
case 15143:
$cost = 27.95;
$signups[$brandserviceid]['name'] = "Latin Plan";
$latinplan['signups'] = $signups[$brandserviceid]['amount'];
$latinplan['cost'] = $cost;
break;
case 15142:
$cost = 27.95;
$signups[$brandserviceid]['name'] = "Asia Plan";
$asiaplan['signups'] = $signups[$brandserviceid]['amount'];
$asiaplan['cost'] = $cost;
break;
case 15145:
$cost = 18.95;
$signups[$brandserviceid]['name'] = "World Plan";
$worldplan['signups'] = $signups[$brandserviceid]['amount'];
$worldplan['cost'] = $cost;
break;
case 15144:
$cost = 22.95;
$signups[$brandserviceid]['name'] = "StayInTouch Plan";
$sitplan['signups'] = $signups[$brandserviceid]['amount'];
$sitplan['cost'] = $cost;
break;
}
$signups[$brandserviceid]['cost'] = $signups[$brandserviceid]['amount'] * $cost;
}
// build the tables
$html = "<h2>Monthly report<h2>\n\t<h3>Customer Signups</h3>\n\t\t<table>\n\t\t\t<th>Plan</th><th>Signups</th><th>Total Cost</th>\n\t\t\t";
foreach($signups as $brandserviceid => $signup) {
// calculate the total number of accounts
$totalaccounts = $totalaccounts + $signup['amount'];
$totalcost = $signup['cost'] + $totalcost;
// append data to table
$html .= "<tr><td>". $signup['name'] . "</td>";
$html .= "<td>" . $signup['amount'] . "</td>";
$html .= "<td>" . round($signup['cost'], 2) ."</td>";
}