<?
include "./auth.inc.php";
if (!$month || !$year){
?>
<FORM>
<P>Date: <SELECT NAME="month">
<?
$nowm=date("m");
for ($i=1;$i<13;$i++){
$monthname=date("F", mktime(0,0,0,$i,2,2000));
print "<option value=\"$i\"";
if ($i==$nowm-1){
print " selected";
}
print ">$monthname</option>\n";
}
?></select> <SELECT NAME="year">
<?
print "<option>";
print date("Y")-1;
print "</option>\n";
print "<option selected>";
print date("Y");
print "</option>\n";
print "<option>";
print date("Y")+1;
print "</option>\n";
?>
</SELECT>
<P>
<INPUT TYPE=SUBMIT VALUE="Go">
</FORM>
<?
exit;
}
$sql = "SELECT min(MasterAccounts.CustomerID),AccountType,min(AccountID), TO_DAYS(now())-TO_DAYS(LastUse)
FROM MasterAccounts,SubAccounts
WHERE Reseller >0
AND Month(CreateDate)=$month
AND YEAR(CreateDate)=$year
AND MasterAccounts.CustomerID=SubAccounts.CustomerID
group by MasterAccounts.CustomerID
";
print "<TABLE BORDER=1>\n";
$res = mysql_query($sql);
print mysql_error();
while ($r = mysql_fetch_row($res)){
$ac[$r[1]]++;
$i++;
#print "$r[3],";
if ($r[1] != 'dealerspecial' && $r[3] <30){
$kept++;
}
#print "<TR>";
#print "<TD>$r[0]</TD>";
#print "<TD>$r[1]</TD>";
#print "</TR>";
}
while (list($var,$val) = each($ac)){
print "<TR>";
print "<TD>$var</TD>";
print "<TD>$val</TD>";
print "</TR>";
}
print "<TR><TD><B>Total</B></TD>";
print "<TD>$i</TD></TR>";
?>
</table>
Signup Churn is <?
$c = intval(100 * $ac[dealerspecial]/$i);
print $c;
?>%
<P>
Of those that Joined, we kept <? echo intval(100*$kept /($i - $ac[dealerspecial])) ?>% of them to date.
<P>
This makes <? echo intval(100 * ($i - $kept)/$i) ?>% churn overall
<P><A HREF="dsused.php?month=<? echo $month ?>&year=<? echo $year ?>">Show Resources used by these
dealerspecials</A>