Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/billingplan/BillingPlan.php
<?php
 /*     This file is used to display all cards that have been created
	It is expected that in production, this feature will be rather
	useless because of the number of accounts that will build up
	over time.  Some sort of method for clearing old accounts will
	need to be implemented.  For now, AllCards is the first step
	in building a reporting system.

	This file C. Carl H. Peterson 2004 and released under the GPL.
	If you didn't get a copy of the GPL with this, do a search for
	GPL and find it your self.  Remember, I copyrighted this so if
	you are using it you better have a license to use it.  GPl 
	works for me.
*/

//////////////////////////////////////////////////////////
//	THIS SCRIPT DISPLAYS ACCOUNTS FOR A LOCATION	//
//	First we pull the session location ID and then	//
//	use it to pull the correct cards.  		//
//	we use the button ID to figure out which type	//
//	of cards we want to pull			//
//////////////////////////////////////////////////////////

	

//////////////////////////////////////////////////////////
//	THIS WAS THE 0.1X CODE.  INCLUDED IF NO MSG	//
//////////////////////////////////////////////////////////

$q1 = "select Id,NameBp,TimeBp,PriceBp,TypeBp,CurrencyBp From BillingPlan WHERE LocationID='".$_SESSION['locID']."' ORDER BY NameBp"; // get all the timed cards
	

$result1=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING

if (!$result1) {
	  $_SESSION['error']='Invalid request : ' . "Query database error !";
	  echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
	  return;
}

$numrows=$oreon->database->database->result_num_rows($result1);

if ($numrows == 0) 
{
	echo '<p class="error"> No billing plan found, please create one or more !</p>';
	return;
}


echo "<p class=\"information\">Available Billing Plan :</p>";
echo "<table width=\"650\" border=2>";
echo"<tr>";

echo "<td class=\"bpcell\" width=180>";
echo "<b>Name</b>";
echo "</td>";
echo "<td class=\"bpcell\" width=80>";
echo "<b>Minutes/Mo/Days</b>";
echo "</td>";
echo "<td class=\"bpcell\" width=80>";
echo "<b>Price</b>";
echo "</td>";
echo "<td class=\"bpcell\" width=80>";
echo "<b>Type</b>";
echo "</td>";
echo "</tr>";
	
		
while ($row = $oreon->database->database->fetch_object($result1)) {
	if(!isset($shade)) { $shade = 2;}
	$array[] = $row; 
	$Name= ($row->NameBp);
	$Time=($row->TimeBp);
	$Price=($row->PriceBp);
	$Type=($row->TypeBp);
	$Currency=($row->CurrencyBp);
	echo("<tr>");
	
	if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
	else{ echo('<td STYLE="background-color: #cde5f4">'); }
	echo($Name);
	echo("</td>");
	
	if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
	else{ echo('<td STYLE="background-color: #cde5f4">'); }
	
	if ($Type=="Expiration") 
		$Value=date_from_attribute($Time,$dateFormat);

	if ($Type=="Time") 
		$Value=time2str($Time);

	else if ($Type=="Octets")
		$Value=octets2str($Time);

	echo("<small>".$Value."</small>");
 
	echo("</td>");
	
	if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
	else{ echo('<td STYLE="background-color: #cde5f4">'); }
	echo("<small>".$Price);
	echo(" ".$Currency."</small>");
	echo("</td>");
	
	if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
	else{ echo('<td STYLE="background-color: #cde5f4">'); }
	echo($Type);
	echo("</td>");
	
	echo("</tr>");
	if($shade == 1) { $shade = 2;}else{ $shade = 1; }
}
echo "</table>";

?>		
Return current item: phpMyPrepaid