Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/billingplan/ModifyBillingPlan.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.

	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']."'"; // get all the timed cards
	
	
	echo "<p class=\"information\">All Billing plan are listed here : </p>";
	
	
	$result1 = $oreon->database->database->query($q1);
	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) 
	{
		$_SESSION['error']=" No billing plan found, please create one or more !";
		echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
		return;
	}
	
	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>";
	
	
	printf('<form  name="center" id="center" action="phpmyprepaid.php" method="post">');
	if(isset($_POST['ID'])) { $pullUser=$_POST['ID'];
	unset($_POST['ID']);}
	
	while ($row = $oreon->database->database->fetch_object($result1)) {
		if(!isset($shade)) { $shade = 2;}
		$array[] = $row; 
		$Id= ($row->Id);
		$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">'); }
		printf('<input type="radio" name="modBp" value="%s" %s/> %s<br />',
		$row->Id,
		(isset($_REQUEST['delBp']) and $_REQUEST['delBp'] == $row->TimeBp) ? 'checked="checked" ' : '',
		$row->NameBp);
		
		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>";
	
	echo('<input type="hidden" name="buttonID" value="modbp">');
	echo('<input type="hidden" name="IdBp" value="'.$Id.'">');
        echo '<input name="LocationID" value="'.$_SESSION['locID'].'" type="hidden">';
	echo "<br>";
	echo ('<td align="right"><tr>');
	echo ("<input type=\"submit\" name=\"submit\" class=\"smallButton\" value=\"Modify billing plan \" />");
	echo ('</td></tr>');
	echo '</form>';
	
	
	//////////////////////////////////////////////////////////////////
	//	END VERSION 0.4X CODE					//
	//////////////////////////////////////////////////////////////////

?>		
Return current item: phpMyPrepaid