Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/reports/ExpiredUser.php
<?php

include ('../../config.inc.php');
if ($_GET['phpmyprepaid']) {
	$oreon_db = new OreonDatabase($conf_pra['host'], $conf_pra['user'] ,$conf_pra['password'] ,$conf_pra['db'] );
	$oreon_db->reload_session_popup($_GET['phpmyprepaid']);
}
echo "<br><br>Expired User list  <span style=\"font-weight: bold;\"> </span>  &nbsp; &nbsp; &nbsp; Created the ";
echo '<span style="font-weight: bold;">';
echo date($dateFormat);
echo "<span><br>";

echo  "<br>From Date $after To Date $before";
echo '
<br>
<br>
<br>
<table border="4" style="text-align: left; width: 914px; height: 58px;"
 cellpadding="2" cellspacing="2">
<tbody>
<tr border="4" style="text-align: left; width: 914px; height: 58px;"
 cellpadding="2" cellspacing="2">
<td border="1" style="width: 20%; background-color: rgb(192, 192, 192);">Name
</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Type</td>
<td style="background-color: rgb(192, 192, 192);">Good For</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Session Time</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Session Number</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Session Download</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Price</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Billing Plan</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Creation Date</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Activate Date</td>
</tr>';
$sum=0;
$sumv=0;
$sums=0;
$sumd=0;
$tab[0]='time';
$tab[1]='octet';
$tab[2]='expiration';

for ($i=0;$i<3;$i++)
{
if ($array[$tab[$i]] != 0) 
foreach ($array[$tab[$i]] as $name) 	
{
 $search="SELECT SUM(AcctSessionTime) AS sumacctsessiontime,COUNT(AcctUniqueId) AS sumsessionnumber,SUM($acctoutputoctetsattr) AS sumdownload from $sql_accounting_table WHERE UserName='$name'  GROUP BY UserName $order  ;";

$result = $oreon->database->database->query($search) or die("Query database error !");
while ($row = $oreon->database->database->fetch_object($result)) {
	$acctst=$row->sumacctsessiontime;
	$acctsn=$row->sumsessionnumber;
	$acctd=$row->sumdownload;
}

 $search="SELECT Type,BillingPlan,CrDate,activeDate from userinfo WHERE userinfo.UserName='$name' $order ;";
$result = $oreon->database->database->query($search) or die("Query database error !");
while ($row = $oreon->database->database->fetch_object($result)) {
  	$type=$row->Type;
  	$billingplan=get_plan_name($row->BillingPlan);
  	$CrDate=$row->CrDate;
  	$ActiveDate=$row->activeDate;
	$Price=get_plan_price($row->BillingPlan);
  	$value=get_user_value($name,$type,False,False);
}

if ($type=="Hourly" or $type=="Subscription Time") 
     $value=$value/60;
if ($type=="Subscription Expiration")
     $value=date($dateFormat,strtotime($value));
if ($type=="Octets" or $type=="Subscription Octets")
     $value=$value/(1024*1024);
$sum+=$Price;
$sumv+=$value;
$sums+=$acctst;
$sumsn+=$acctsn;
$sumd+=$acctd;
if ($Price=='') $Price=0;
if ($billingplan=='') $billingplan='None';
echo ("<tr>
      <td >$name</td>
      <td >$type</td>
      <td >$value</td>
      <td >".time2str($acctst)."</td>	 
      <td >$acctsn</td>	 
      <td >".octets2str($acctd)."</td>	 
      <td >$Price</td>
      <td >$billingplan</td>
      <td >$CrDate</td>
      <td >$ActiveDate</td>
      </tr>    
      ");
}
}
$sumv=time2str($sumv);
$sums=time2str($sums);
$sumd=octets2str($sumd);
  echo ("<tr>
  <td ><b>Total Amount</td>
      <td >:</td>
      <td ></td>
      <td >$sums</td>
      <td >$sumsn</td>
      <td >$sumd</td>
      <td >$sum</td>
      <td ></td>
      <td ></td>
      <td ></td>
      </tr>");  

echo (" </tbody></table><br><br></body></html>");
?>
Return current item: phpMyPrepaid