Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/reports/UserAccounting.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>User Accounting  <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: 714px; height: 58px;"
 cellpadding="2" cellspacing="2">
<tbody>
<tr border="4" style="text-align: left; width: 714px; 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);">Billing Plan</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Activate Date</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Accounting Start</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Session Time</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Upload Octet</td>
<td border="1" style="background-color: rgb(192, 192, 192);">Download Octet</td>
</tr>';
$result = $oreon->database->database->query($search) or die("Query database error !");

if ($result){
 
$arrayres=$oreon->database->database->fetch_array($result);
if ($arrayres != NULL ) 
  while( $arrayres != NULL && $row = array_change_key_case($arrayres)) {
	$arrayres=$oreon->database->database->fetch_array($result);
 	$username=$row['username']; 
  	$type=$row['type'];
  	$value=$row['value'];
  	$billingplan=get_plan_name($row['billingplan']);
  	$ActiveDate=$row['activedate'];
	$acct_logedin = $row['acctstarttime'];
	$acct_sessiontime = $row['acctsessiontime'];
	$acct_sessiontime_sum += $acct_sessiontime;
	$acct_sessiontime = time2str($acct_sessiontime);
	$acct_upload = $row[$acctinputoctetsattr];
	$acct_upload_sum += $acct_upload;
	$acct_upload = octets2str($acct_upload);
	$acct_download = $row[$acctoutputoctetsattr];
	$acct_download_sum += $acct_download;
	$acct_download = octets2str($acct_download);
  echo ("<tr>
      <td >$username</td>
      <td >$type</td>
      <td >$value</td>
      <td >$billingplan</td>
      <td >$ActiveDate</td>
      <td >$acct_logedin</td>
      <td >$acct_sessiontime</td>
      <td >$acct_upload</td>
      <td >$acct_download</td>
      </tr>    
      ");
}

echo ("<tr>
     <td ><b>TOTAL </td>
      <td ></td>
      <td ></td>
      <td ></td>
      <td ></td>
      <td ></td>
      <td ><b>".time2str($acct_sessiontime_sum)."</td>
      <td ><b>".octets2str($acct_upload_sum)."</td>
      <td ><b>".octets2str($acct_download_sum)."</td></tr>");
      
echo (" </tbody></table><br><br></body></html>");
}
?>
Return current item: phpMyPrepaid