Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/reports/ActivateUser.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>Activate User list  <span style=\"font-weight: bold;\"> </span>  &nbsp; &nbsp; &nbsp; Created the ";
echo '<span style="font-weight: bold;">';
echo date("d/m/Y H:m:s");
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: 814px; 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;
while ($row = $oreon->database->database->fetch_object($result)) {
 	$username=$row->UserName; 
  	$type=$row->Type;
  	$value=$row->Value;
  	$billingplan=get_plan_name($row->BillingPlan);
  	$CrDate=$row->CrDate;
  	$ActiveDate=$row->val;
  	$Price=get_plan_price($row->BillingPlan);

 $search="SELECT SUM(AcctSessionTime) AS sumacctsessiontime,COUNT(AcctUniqueId) AS sumsessionnumber,SUM($acctoutputoctetsattr) AS sumdownload from $sql_accounting_table WHERE $sql_accounting_table.UserName='$username'  AND AcctStopTime>='$after' AND AcctStopTime<='$before'  $order ;";
 $result2 = $oreon->database->database->query($search) or die("Query database error !");
  $row2 = $oreon->database->database->fetch_object($result2);
  $sum+=$Price;
  $sumv+=$value;
  $sums+=$row2->sumacctsessiontime;
  $sumsn+=$row2->sumsessionnumber;
  $sumd+=$row2->sumdownload;
  
  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);

    if ($Price=='') $Price=0;
    if ($billingplan=='') $billingplan='None';
  echo ("<tr>
      <td >$username</td>
      <td >$type</td>
      <td >$value</td>
      <td >".time2str($row2->sumacctsessiontime)."</td>	 
      <td >$row2->sumsessionnumber</td>	 
      <td >".octets2str($row2->sumdownload)."</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