<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";

$adminCurrency	= GetAdminCurrency();

if(isset( $_SESSION["sess_adminname"]) and $_SESSION["sess_adminname"]!= ""){
	$adminname = $_SESSION["sess_adminname"];
}else{
	header("Location:login.php");
	exit;
}


$planval	= $_GET['planval'];

if(isset($_GET["txtSearch"]) and $_GET["txtSearch"]!=""){
	$txtSearch = $_GET["txtSearch"];
	$cmbSearchType = $_GET["cmbSearchType"];
}else if(isset($_POST["txtSearch"]) and $_POST["txtSearch"]!=""){
	$txtSearch = $_POST["txtSearch"];
	$cmbSearchType = $_POST["cmbSearchType"];
}


if(isset($_POST['gotoPage']))
{

	header("Location:".$_SERVER['PHP_SELF']."?page=".$_POST['gotoPage']);
}

	
	 $sql = "SELECT plan_Id, plan_Title,plan_Description,plan_Status,plan_SubscriptionCharge,plan_Period
		FROM ".$tableprefix."sellerPlans  WHERE plan_Id='".$planval."' " ;
		
	$rs_plan=mysql_query($sql) or die(mysql_error());
	
	if(mysql_num_rows($rs_plan)>0)
	{
		$rsObj	= mysql_fetch_object($rs_plan);
	}
		
		


$select_seller = "SELECT artist_id,artist_name FROM ".$tableprefix."artists WHERE 1";
$result_seller = mysql_query($select_seller) or die(mysql_error());



 $sql = "SELECT ar.*,am.*
		FROM ".$tableprefix."artists  ar
		INNER JOIN ".$tableprefix."artists_membershipDetails am ON ar.artist_id = am.artist_id 
		INNER JOIN ".$tableprefix."sellerPlans s ON s.plan_Id = ar.sellerPlanID AND  s.plan_Id = am.plan_Id 
		WHERE ar.sellerPlanID ='".$planval."' ORDER BY am.artist_memEndDate  DESC  ";
		 
		
	if(!(isset($pagenum)))
	{
		$pagenum = 1;
	} 
	
	$limit = getSettingsValue('npagination_limit');
	
	$page = isset($_GET['page'])? trim($_GET['page']):1;

	
	if(empty($page))
	{
		$page = 1;
	}
	
	$result=mysql_query($sql) or die(mysql_error());						
	
	$totalrows = mysql_num_rows($result);
	
	$limitvalue = ($page - 1) * $limit;
	
	$query_string = " LIMIT $limitvalue, $limit";
	
	$sql = $sql.$query_string;
	$rs = mysql_query($sql) or die(mysql_error());

	$numofpages = ceil($totalrows / $limit);
	if($_GET["message"] && !$message)
	$message = $_GET["message"];

include "../includes/htmltop.php";

?>

<script>
function clickSearch()
{
	document.frmMyProducts.submit();
}

function addValues(order_value)
{
		
	var checkbox_values = "";	
	
	for(i=1;i<=document.frmMyProducts1.checkCount.value;i++)
	{
	
		var checkbox_name = "Product_"+i;
			
		if(document.getElementById(checkbox_name).checked)
		{
			checkbox_values += document.getElementById(checkbox_name).value + ',';
		}
				
		document.frmMyProducts2.txtProductId.value = checkbox_values;
		
			
	}		
}

function checkAllOrders()
{

	var checkbox_values = "";	
	
	if(document.frmMyProducts1.checkAllBox.checked)
	{
				
		for(i=1;i<=document.frmMyProducts1.checkCount.value;i++)
		{
		
			var checkbox_name = "Product_"+i;
			document.getElementById(checkbox_name).checked = true;	
			checkbox_values += document.getElementById(checkbox_name).value + ',';
						
		}
		
		document.frmMyProducts2.txtProductId.value = checkbox_values;

	}
	else
	{
		for(i=1;i<=document.frmMyProducts1.checkCount.value;i++)
		{
		
			var checkbox_name = "Product_"+i;
			document.getElementById(checkbox_name).checked = false;	
			
		}
		
		document.frmMyProducts2.txtProductId.value = "";
	}


}

function deleteProducts()
{
	if(document.frmMyProducts2.txtProductId.value == "")
	{
		alert('<?php echo SEL_DEL;?>');
	}
	else
	{
		
		var status =  confirm('<?php echo DELETE_PRODUCTS;?>');
		
		if(status == true)
		{
			document.frmMyProducts2.submit();
		}	
	}
	
}


</script>
		
		<body>
		
		<center>
		
		<div align="left" id="layout">
		
		
				
				
				<!--header area start -->
<?php

	include_once("../includes/topheader_admin.php")

?>
				
				<!--header area end -->
				
				
				
				
				<div align="left" class="main_body">
				<!--main body start -->
				
				
				
<?php
		include_once("../includes/admintopmenu.php")
?>		
																					
								
					<div align="left" class="content_area">
					
					<!--content area start -->
							
					<div align="left" class="page_title"><?php echo SELLER_UNDER;?>  <?php echo $rsObj->plan_Title?>  <?php echo PLAN;?> </div>
					<div align="center" class="text_information grey_tr"><?php echo $message?></div>
            		<br>
											
					<div align="left">					
					
																																				
					<table border="0" width="100%" cellpadding="0" cellspacing="0" class="manage_table">
					<form action="" method="post" name="frmMyProducts1">
						<tr class="form_header">
							<th width="5%">#</th>
							<th width="20%" align="left"><?php echo SELLERNAME;?></th>
							<th width="16%" align="left"> <?php echo START_DATE;?> </th>
							<th width="17%" align="left"><?php echo END_DATE;?> </th>
							<th width="21%" align="left"><?php echo PLAN_AMT;?> </th>
							<th width="15%" align="left">&nbsp;</th>
							<th width="6%">&nbsp;</th>
						</tr>
						
						
<?php
if(mysql_num_rows($result) > 0 )
{
	$i = 1;
	while($row = mysql_fetch_array($rs))
	{
		$link = "<a class=links href='editartist.php?artistid=".$row["artist_id"]."'>";
?>
				<tr> 
					<td><?php echo (($page*$limit)+$i-$limit)?></td>
					<td align="left"><?php echo $link .stripslashes($row["first_name"]). " " .stripslashes($row["last_name"])."</a>";?></td>
					<td><?php echo $link .dateFormat($row["artist_memStartDate"], "Y-m-d", "m/d/Y")."</a>";?>  </td>
					<td><?php echo $link .dateFormat($row["artist_memEndDate"], "Y-m-d", "m/d/Y")."</a>";?></td>
					<td align=""><?php echo $adminCurrency['currency_symbol'];?> &nbsp;<?php echo $link .$row["plan_SubscriptionCharge"]."</a>";?></td>
					<td align="center">&nbsp;
				  </td>
												
				</tr>
<?php
	$i++;
	}
?>	
	
	<input type="hidden" name="checkCount" value="<?php echo $i-1?>">
<?php	

}
else
{
										
?>					
							<tr>
									<td height="44" colspan="7" align="center" valign="middle"  class="text_information"><?php echo NO_SELLER_FOUND;?></td>
							</tr>
							
											
<?php										
}

?>

							<tr>
									<td height="65" colspan="7" align="center" valign="middle"  class="text_information">
						      <input type="button" name="Submit" value="<?php echo BACK_TO_PLAN;?>" class="button" onClick="Javascript:window.location.href='sellerPlanes.php'"></td>
							</tr>	

<?php
if($page > 1)
{
	$pageprev = $page-1;
	
	$previous_page = "<a href=".$_SERVER['PHP_SELF']."?page=$pageprev alt='Previous' border='0'><img src='../images/previous_btn_admin.gif' alt='Next' border='0'/></a>";
	
}
																				
													
if($page < $numofpages)
{
	$pagenext = ($page + 1);
	
	$next = "<a href=".$_SERVER['PHP_SELF']."?page=$pagenext alt='Next' border='0'><img src='../images/next_btn_admin.gif' alt='Next' border='0'/></a>";
	
}	




							  if($numofpages)
							  {
							  ?>

								
										<tr>
											<td class="page_nos"  align="center" colspan="2"><?php echo $previous_page?>&nbsp;<?php echo $next?></td>
											<td align="right" valign="middle" class="page_nos" colspan="3"><?php echo PAGE_TEXT;?> <?php echo $page ?>/<?php echo $numofpages?>&nbsp;&nbsp;<?php echo GO_TO;?></td>
											<td colspan="2" align="center" valign="middle" class="page_nos">
											<select class="textarea2" name="gotoPage">
  <?php
									for($i=1;$i<=$numofpages;$i++)
									{		
										
										
										if($i == $_GET['page'])
										{
											$page_selected = "selected";
										}
										else
										{
											$page_selected = "";
										}
										
										
?>									
									  <option value="<?php echo $i?>" <?php echo $page_selected?>><?php echo $i?></option>
									  
<?php
									}
									
?>									
										      </select>	
										    <a onClick="Javascript:document.frmMyProducts1.submit();" style="cursor:pointer"><img src="../images/go_btn.gif" alt=""  /></a>										</td>
										</tr>
										<?php
										}
										?>
					  </form>
										<tr>
										<td colspan="7">
										<form name="frmMyProducts2" method="post" action="#">
										<input type="hidden" name="txtProductId">
										</form>
										</td>
										</tr>
					  </table>
								
					  </div>
						
						
				<!--content area end-->
								
				</div>
				
								
					<div align="left" class="clear_float"><img src="<?php echo $imagefolder;?>/clear.gif" alt="" width="1" height="1" /></div>
				<!--main body end -->
				</div>
				
				
<?php
	include "../includes/footer.php";
?>